public class RegisterAllocatorState extends Object
| Modifier and Type | Field and Description |
|---|---|
private Map<Instruction,Integer> |
depthFirstNumbers |
private CompoundInterval[] |
intervals |
private int[] |
spills |
| Constructor and Description |
|---|
RegisterAllocatorState(int registerCount) |
| Modifier and Type | Method and Description |
|---|---|
(package private) void |
clearOneToOne(Register r)
Clears any 1-to-1 mapping for a register.
|
int |
getDFN(Instruction inst)
returns the dfn associated with the passed instruction
|
(package private) int |
getDfnBegin(LiveIntervalElement live,
BasicBlock bb) |
(package private) int |
getDfnEnd(LiveIntervalElement live,
BasicBlock bb) |
(package private) CompoundInterval |
getInterval(Register reg)
Returns the interval associated with the passed register.
|
(package private) Register |
getMapping(Register r) |
int |
getSpill(Register reg) |
(package private) void |
initializeDepthFirstNumbering(int instructionCount)
Initializes data structures for depth first numbering.
|
(package private) void |
mapOneToOne(Register A,
Register B)
Records that register A and register B are associated with each other
in a bijection.
|
(package private) void |
printDfns(IR ir)
Prints the DFN numbers associated with each instruction.
|
(package private) void |
resetPhysicalRegisters(IR ir)
Resets the physical register info.
|
(package private) void |
setDFN(Instruction inst,
int dfn)
Associates the passed dfn number with the instruction
|
(package private) void |
setInterval(Register reg,
CompoundInterval interval)
Associates the passed live interval with the passed register.
|
(package private) void |
setSpill(Register reg,
int spill) |
private final int[] spills
private final CompoundInterval[] intervals
private Map<Instruction,Integer> depthFirstNumbers
RegisterAllocatorState(int registerCount)
void resetPhysicalRegisters(IR ir)
ir - the IR whose info is to be resetvoid mapOneToOne(Register A, Register B)
The register allocator uses this state to indicate that a symbolic register is presently allocated to a physical register.
A - first registerB - second registerRegister getMapping(Register r)
r - a registervoid clearOneToOne(Register r)
r - the register whose mapping is to be clearedCompoundInterval getInterval(Register reg)
reg - the registernullvoid initializeDepthFirstNumbering(int instructionCount)
instructionCount - an estimate of the total number of instructions.void setInterval(Register reg, CompoundInterval interval)
reg - the registerinterval - the live intervalvoid setDFN(Instruction inst, int dfn)
inst - the instructiondfn - the dfn numberpublic int getDFN(Instruction inst)
inst - the instructionvoid printDfns(IR ir)
ir - the IR that contains the instructionsint getDfnBegin(LiveIntervalElement live, BasicBlock bb)
live - the live intervalbb - the basic block for the live intervalint getDfnEnd(LiveIntervalElement live, BasicBlock bb)
live - the live intervalbb - the basic block for the live interval