Modifier and Type | Class and Description |
---|---|
private static class |
DefUse.RegOpListWalker
Utility class to encapsulate walking a use/def list.
|
Modifier and Type | Field and Description |
---|---|
(package private) static boolean |
DEBUG |
(package private) static boolean |
SUPRESS_DU_FOR_PHYSICALS |
(package private) static boolean |
TRACE_DU_ACTIONS |
Constructor and Description |
---|
DefUse() |
Modifier and Type | Method and Description |
---|---|
static void |
clearDU(IR ir)
Clear defList, useList for an IR.
|
static void |
computeDU(IR ir)
Compute the register list and def-use lists for a method.
|
static Enumeration<RegisterOperand> |
defs(Register reg) |
(package private) static boolean |
exactlyOneUse(Register reg) |
private static void |
logAppearance(Register reg,
int bbNum,
int[] bbNums)
Mark that we have seen a register in a particular
basic block.
|
static void |
mergeRegisters(IR ir,
Register reg1,
Register reg2)
Merges a register into another register and removes the
merged register from the DU information.
|
(package private) static void |
printDefs(Register reg) |
(package private) static void |
printUses(Register reg) |
static void |
recomputeSpansBasicBlock(IR ir)
Recompute spansBasicBlock flags for all registers.
|
static void |
recomputeSSA(IR ir)
Recompute
isSSA for all registers by traversing register
list. |
static void |
recordDef(RegisterOperand regOp)
Record a def of a register
|
static void |
recordDefUse(RegisterOperand regOp)
Record a def/use of a register
TODO: For now we just pretend this is a use!!!!
|
static void |
recordUse(RegisterOperand regOp)
Record a use of a register
|
static void |
removeDef(RegisterOperand regOp)
Record that a def of a register no longer applies
|
static void |
removeInstructionAndUpdateDU(Instruction s) |
static void |
removeUse(RegisterOperand regOp)
Record that a use of a register no longer applies
|
static void |
replaceInstructionAndUpdateDU(Instruction oldI,
Instruction newI) |
private static boolean |
seenInDifferentBlock(Register reg,
int bbNum,
int[] bbNums) |
static void |
transferUse(RegisterOperand origRegOp,
RegisterOperand newRegOp)
This code changes the use in
origRegOp to use
the use in newRegOp . |
static void |
updateDUForNewInstruction(Instruction s) |
static Enumeration<RegisterOperand> |
uses(Register reg) |
static final boolean DEBUG
static final boolean TRACE_DU_ACTIONS
static final boolean SUPRESS_DU_FOR_PHYSICALS
public DefUse()
public static void clearDU(IR ir)
ir
- the IR in questionpublic static void computeDU(IR ir)
ir
- the IR in questionpublic static void recordUse(RegisterOperand regOp)
regOp
- the operand that uses the registerpublic static void recordDefUse(RegisterOperand regOp)
regOp
- the operand that uses the registerpublic static void recordDef(RegisterOperand regOp)
regOp
- the operand that uses the registerpublic static void removeUse(RegisterOperand regOp)
regOp
- the operand that uses the registerpublic static void removeDef(RegisterOperand regOp)
regOp
- the operand that uses the registerpublic static void transferUse(RegisterOperand origRegOp, RegisterOperand newRegOp)
origRegOp
to use
the use in newRegOp
.
If the type of origRegOp
is not a reference, but the
type of newRegOp
is a reference, we need to update
origRegOp
to be a reference.
Otherwise, the GC map code will be incorrect. -- Mike Hind
origRegOp
- the register operand to changenewRegOp
- the register operand to use for the changepublic static void removeInstructionAndUpdateDU(Instruction s)
public static void updateDUForNewInstruction(Instruction s)
public static void replaceInstructionAndUpdateDU(Instruction oldI, Instruction newI)
public static Enumeration<RegisterOperand> uses(Register reg)
public static Enumeration<RegisterOperand> defs(Register reg)
static boolean exactlyOneUse(Register reg)
public static void recomputeSSA(IR ir)
isSSA
for all registers by traversing register
list.
NOTE: the DU MUST be computed BEFORE calling this functionir
- the IR in questionpublic static void mergeRegisters(IR ir, Register reg1, Register reg2)
reg1
- the register that is being merged intoreg2
- the register that's being merged (and then removed from the
DU information)ir
- the governing IRpublic static void recomputeSpansBasicBlock(IR ir)
ir
- the IR in questionprivate static void logAppearance(Register reg, int bbNum, int[] bbNums)
reg
- the registerbbNum
- the number of the basic blockbbNums
- last block were each register was seenprivate static boolean seenInDifferentBlock(Register reg, int bbNum, int[] bbNums)
reg
- the registerbbNum
- the number of the basic blockbbNums
- last block were each register was seentrue
if the register was seen in a different basic block
than the one that was passed to this method