class NInterval extends Object implements Comparable<NInterval>
Modifier and Type | Field and Description |
---|---|
ArrayList<NInterval> |
children
Children of this interval.
|
int |
offset
Offset.
|
OffsetFrom |
offsetFrom
From offset.
|
NInterval |
parent
Parent of this interval.
|
NPhysicalRegister |
pRegister
The NPhyicalRegister assigned to this interval.
|
ArrayList<NRange> |
ranges
All live ranges for this virtual register
|
boolean |
spill
Whether or not to spill.
|
TreeMap<Integer,InstructionType> |
usePositions
All use positions (in LIR) and their types for this virtual register
|
int |
vRegId
The virtual register id corresponding to the index in the array list of
NIntervals used by register allocation
|
Constructor and Description |
---|
NInterval(int virtualRegID,
NControlFlowGraph cfg)
Construct a NInterval with the given virtual register ID for the given
control flow graph.
|
NInterval(int virtualRegID,
NControlFlowGraph cfg,
ArrayList<NRange> childRanges,
NInterval parent)
This second constructor is used in instantiating children of a split
interval.
|
Modifier and Type | Method and Description |
---|---|
void |
addOrExtendNRange(NRange newNRange)
Add a new range to the existing ranges.
|
void |
addUsePosition(Integer index,
InstructionType type)
Register a use (read or write)>
|
NInterval |
childAt(int idx)
The child interval at a given instruction index.
|
NInterval |
childAtOrEndingBefore(NBasicBlock b)
A child of this interval which is live or ends before the given basic
block's end.
|
NInterval |
childAtOrStartingAfter(NBasicBlock b)
The child of this interval which is live or starts after the given basic
block's start
|
int |
compareTo(NInterval other)
Compare start positions (for ordering intervals).
|
int |
endsAtBlock()
The basic block in which this interval's end position falls.
|
boolean |
equals(NInterval other)
Two intervals are equal if they have the same virtual register ID.
|
int |
firstRangeStart()
The start position for the first range.
|
int |
firstUsage()
The first use position in this interval.
|
boolean |
isChild()
Is this interval a child interval?
|
boolean |
isLiveAt(int atIndex)
Check if this vreg is alive at a given index.
|
boolean |
isParent()
Is this interval a parent interval? (Ie, does it have children?)
|
int |
lastNRangeStop()
The stop position for the last range.
|
void |
newFirstRangeStart(int newStart)
Sets the start value of the very first range.
|
int |
nextIntersection(NInterval otherInterval)
Looks for the very first position where an intersection with another
interval occurs.
|
int |
nextUsageOverlapping(NInterval currInterval)
The next use position of this interval after the first range start of the
foreign interval.
|
void |
spill()
Assigns an offset to this interval (if one hasn't been already assigned).
|
NInterval |
splitAt(int idx)
Split the current interval at the given index.
|
int |
startsAtBlock()
Returns the basic block in which this interval's start position falls.
|
void |
writeToStdOut(PrettyPrinter p)
Write the interval information to STDOUT.
|
public int vRegId
public TreeMap<Integer,InstructionType> usePositions
public NPhysicalRegister pRegister
public boolean spill
public OffsetFrom offsetFrom
public int offset
public NInterval parent
public NInterval(int virtualRegID, NControlFlowGraph cfg)
virtualRegID
- program counter.cfg
- The control flow graph.public NInterval(int virtualRegID, NControlFlowGraph cfg, ArrayList<NRange> childRanges, NInterval parent)
virtualRegID
- program counter.cfg
- The control flow graph.childRanges
- The instruction ranges for this child.parent
- The parent interval.public void addOrExtendNRange(NRange newNRange)
newNRange
- - the NRange to addpublic int nextIntersection(NInterval otherInterval)
otherInterval
- the interval to compare against for intersection.public int nextUsageOverlapping(NInterval currInterval)
currInterval
- the interval with starting point after which we want to find
the next usage of this one.public int firstUsage()
public void newFirstRangeStart(int newStart)
newStart
- the value to which the first range's start will be set.public void addUsePosition(Integer index, InstructionType type)
index
- the site of the use.type
- the instruction type.public boolean isLiveAt(int atIndex)
atIndex
- the index at which to see if this register is live.public void writeToStdOut(PrettyPrinter p)
p
- for pretty printing with indentation.public int firstRangeStart()
public int lastNRangeStop()
public int compareTo(NInterval other)
compareTo
in interface Comparable<NInterval>
other
- interval to compare to.public boolean equals(NInterval other)
other
- the interval we are comparing ourself with.public NInterval splitAt(int idx)
idx
- the index at which this interval is to be splitpublic NInterval childAt(int idx)
idx
- The instruction index.public NInterval childAtOrEndingBefore(NBasicBlock b)
b
- the basic block.public NInterval childAtOrStartingAfter(NBasicBlock b)
b
- the basic blockpublic int startsAtBlock()
public int endsAtBlock()
public void spill()
public boolean isChild()
public boolean isParent()