public class MIRSplitRanges extends CompilerPhase
container| Constructor and Description |
|---|
MIRSplitRanges() |
| Modifier and Type | Method and Description |
|---|---|
private static RegisterOperand |
findOrCreateTemp(RegisterOperand rOp,
HashMap<Register,Register> map,
IR ir)
Finds or creates a temporary register to cache a symbolic register.
|
String |
getName()
Return the name of this phase
|
private static void |
insertMoveAfter(RegisterOperand r2,
RegisterOperand r1,
Instruction s)
Insert an instruction to move r1 into r2 after instruction s.
|
private static void |
insertMoveBefore(RegisterOperand r2,
RegisterOperand r1,
Instruction s)
Inserts an instruction to move r1 into r2 before instruction s.
|
CompilerPhase |
newExecution(IR ir)
Return this instance of this phase.
|
void |
perform(IR ir)
The main method.
|
private static void |
splitAllLiveRanges(Instruction s,
HashMap<Register,Register> newMap,
IR ir,
boolean rootOnly)
Split the live ranges of all register operands of an instruction
|
dumpIR, dumpIR, getClassConstructor, getCompilerPhaseConstructor, getCompilerPhaseConstructor, performPhase, printingEnabled, reportAdditionalStats, setContainer, shouldPerform, verifypublic MIRSplitRanges()
public CompilerPhase newExecution(IR ir)
newExecution in class CompilerPhaseir - not usedpublic final String getName()
getName in class CompilerPhasepublic final void perform(IR ir)
We split live ranges for registers around PEIs which have catch blocks. Suppose we have a PEI s which uses a symbolic register r1. We must ensure that after register allocation, r1 is NOT assigned to a scratch location in s, since this would mess up code in the catch block that uses r1.
So, instead, we introduce a new temporary r2 which holds the value of r1. The live range for r2 spans only the instruction s. Later, we will ensure that r2 is never spilled.
TODO: This could be implemented more efficiently.
perform in class CompilerPhaseir - the governing IRprivate static void splitAllLiveRanges(Instruction s, HashMap<Register,Register> newMap, IR ir, boolean rootOnly)
s - the instruction to processnewMap - a mapping from symbolics to temporariesir - the containing IRrootOnly - only consider root operands?private static RegisterOperand findOrCreateTemp(RegisterOperand rOp, HashMap<Register,Register> map, IR ir)
rOp - the symbolic register operandmap - a mapping from symbolics to temporariesir - the governing IRprivate static void insertMoveBefore(RegisterOperand r2, RegisterOperand r1, Instruction s)
r1 - the move sourcer2 - the move targets - the instruction before which the move needs to be insertedprivate static void insertMoveAfter(RegisterOperand r2, RegisterOperand r1, Instruction s)
r1 - the move sourcer2 - the move targets - the instruction after which the move needs to be inserted