final class ActiveSet extends IncreasingEndMappedIntervalSet
Modifier and Type | Field and Description |
---|---|
private IR |
ir
Governing ir
|
private RegisterAllocatorState |
regAllocState |
(package private) static long |
serialVersionUID
Support for Set serialization
|
private SpillCostEstimator |
spillCost
An object to help estimate spill costs
|
private boolean |
spilled
Have we spilled anything?
|
private SpillLocationManager |
spillManager
Manager of spill locations;
|
c
Constructor and Description |
---|
ActiveSet(IR ir,
SpillLocationManager sm,
SpillCostEstimator cost) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
allocate(BasicInterval newInterval,
CompoundInterval container) |
private boolean |
allocateNewSymbolicToPhysical(Register symb,
Register p)
NOTE: This routine assumes we're processing the first interval of
register symb; so p.isAvailable() is the key information needed.
|
private boolean |
allocateToPhysical(CompoundInterval i,
Register p)
Checks whether it's ok to allocate an interval to a physical
register.
|
private boolean |
checkAssignmentIfSpilled(CompoundInterval i,
CompoundInterval spill)
Checks if it would be possible to assign an interval to the physical
register of another interval if that other interval were spilled.
|
(package private) boolean |
currentlyActive(Register r) |
(package private) void |
expireOldIntervals(BasicInterval newInterval)
For each new basic interval, we scan the list of active basic
intervals in order of increasing end point.
|
(package private) Register |
findAvailableRegister(CompoundInterval ci) |
(package private) Register |
findAvailableRegister(Register symb) |
(package private) void |
freeInterval(MappedBasicInterval bi) |
(package private) BasicInterval |
getBasicInterval(Register r,
Instruction s)
Finds a basic interval for a register so that the interval contains
the instruction.
|
(package private) CompoundInterval |
getCurrentInterval(Register r) |
private Register |
getPhysicalPreference(CompoundInterval ci)
Given the current state of the register allocator, compute the
available physical register to which an interval has the highest
preference.
|
private Register |
getPhysicalPreference(Register r)
Given the current state of the register allocator, compute the
available physical register to which a symbolic register has the
highest preference.
|
private CompoundInterval |
getSpillCandidate(CompoundInterval newInterval) |
(package private) boolean |
spilledSomething() |
private CompoundInterval |
spillMinUnitCost(CompoundInterval newInterval)
Chooses the interval with the minimal unit cost (defined as the number
of defs and uses).
|
private void |
updatePhysicalInterval(Register p,
BasicInterval i)
Updates the interval representing the allocations of a physical
register p to include a new interval i.
|
private void |
updatePhysicalInterval(Register p,
CompoundInterval c,
BasicInterval stop)
Update the interval representing the allocations of a physical
register p to include a new compound interval c.
|
toString
add, addAll, ceiling, clear, clone, comparator, contains, descendingIterator, descendingSet, first, floor, headSet, headSet, higher, isEmpty, iterator, last, lower, pollFirst, pollLast, remove, size, spliterator, subSet, subSet, tailSet, tailSet
equals, hashCode, removeAll
containsAll, retainAll, toArray, toArray
finalize, getClass, notify, notifyAll, wait, wait, wait
containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray
parallelStream, removeIf, stream
static final long serialVersionUID
private final RegisterAllocatorState regAllocState
private final SpillLocationManager spillManager
private final transient SpillCostEstimator spillCost
private boolean spilled
ActiveSet(IR ir, SpillLocationManager sm, SpillCostEstimator cost)
boolean spilledSomething()
void expireOldIntervals(BasicInterval newInterval)
newInterval
- the new intervalvoid freeInterval(MappedBasicInterval bi)
void allocate(BasicInterval newInterval, CompoundInterval container)
private void updatePhysicalInterval(Register p, BasicInterval i)
p
- a physical registeri
- the new intervalprivate void updatePhysicalInterval(Register p, CompoundInterval c, BasicInterval stop)
p
- a physical registerc
- the new intervalstop
- the last interval to be includedboolean currentlyActive(Register r)
r
- a physical registerCompoundInterval getCurrentInterval(Register r)
r
- a physical registerOptimizingCompilerException
- if the register is not currently
allocated to any intervalRegister findAvailableRegister(CompoundInterval ci)
ci
- interval to allocatenull
if no free physical register is foundRegister findAvailableRegister(Register symb)
symb
- symbolic register to allocatenull
if no free physical register is foundprivate Register getPhysicalPreference(Register r)
r
- the symbolic register in question.null
if no preference found.private Register getPhysicalPreference(CompoundInterval ci)
ci
- the interval in questionnull
if no preference foundprivate boolean allocateToPhysical(CompoundInterval i, Register p)
i
- the interval to allocatep
- the physical registertrue
if it's ok to allocate the interval to the
given physical register, false
otherwiseprivate boolean allocateNewSymbolicToPhysical(Register symb, Register p)
symb
- the symbolic registerp
- the physical registerprivate CompoundInterval getSpillCandidate(CompoundInterval newInterval)
newInterval
- a new intervalprivate CompoundInterval spillMinUnitCost(CompoundInterval newInterval)
newInterval
- a new intervalprivate boolean checkAssignmentIfSpilled(CompoundInterval i, CompoundInterval spill)
spill
- the interval that's a candidate for spillingi
- the interval that we want to assign to the register of the spill intervaltrue
if the allocation would fit, false
otherwiseBasicInterval getBasicInterval(Register r, Instruction s)
r
- the register whose interval is desireds
- the reference instructionnull
if there is no basic interval for the given register
that contains the instruction, the interval otherwise. If there are
multiple intervals, the first one will be returned.