const debugtrace … type Interval … type Intervals … func (i Interval) String() string { … } // TEMPORARY until bootstrap version catches up. func imin(i, j int) int { … } // TEMPORARY until bootstrap version catches up. func imax(i, j int) int { … } // Overlaps returns true if here is any overlap between i and i2. func (i Interval) Overlaps(i2 Interval) bool { … } // adjacent returns true if the start of one interval is equal to the // end of another interval (e.g. they represent consecutive ranges). func (i1 Interval) adjacent(i2 Interval) bool { … } // MergeInto merges interval i2 into i1. This version happens to // require that the two intervals either overlap or are adjacent. func (i1 *Interval) MergeInto(i2 Interval) error { … } type IntervalsBuilder … func (c *IntervalsBuilder) last() int { … } func (c *IntervalsBuilder) setLast(x int) { … } func (c *IntervalsBuilder) Finish() (Intervals, error) { … } // Live method should be invoked on instruction at position p if instr // contains an upwards-exposed use of a resource. See the example in // the comment at the beginning of this file for an example. func (c *IntervalsBuilder) Live(pos int) error { … } // Kill method should be invoked on instruction at position p if instr // should be treated as having a kill (lifetime end) for the // resource. See the example in the comment at the beginning of this // file for an example. Note that if we see a kill at position K for a // resource currently live since J, this will result in a lifetime // segment of [K+1,J+1), the assumption being that the first live // instruction will be the one after the kill position, not the kill // position itself. func (c *IntervalsBuilder) Kill(pos int) error { … } // check examines the intervals in "is" to try to find internal // inconsistencies or problems. func check(is Intervals) error { … } func (is *Intervals) String() string { … } type intWithIdx … func (iwi intWithIdx) done() bool { … } type pairVisitor … // init initializes a pairVisitor for the specified pair of intervals // i1 and i2 and returns an intWithIdx object that points to the first // interval by start position within i1/i2. func (pv *pairVisitor) init(i1, i2 Intervals) intWithIdx { … } // nxt advances the pairVisitor to the next interval by starting // position within the pair, returning an intWithIdx that describes // the interval. func (pv *pairVisitor) nxt() intWithIdx { … } // sel is a helper function used by 'init' and 'nxt' above; it selects // the earlier of the two intervals at the current positions within i1 // and i2, or a degenerate (pairIndex -1) intWithIdx if we have no // more intervals to visit. func (pv *pairVisitor) sel() intWithIdx { … } // Overlaps returns whether any of the component ranges in is overlaps // with some range in is2. func (is Intervals) Overlaps(is2 Intervals) bool { … } // Merge combines the intervals from "is" and "is2" and returns // a new Intervals object containing all combined ranges from the // two inputs. func (is Intervals) Merge(is2 Intervals) Intervals { … }