class Coalesce extends Object
CoalesceMoves| Modifier and Type | Field and Description |
|---|---|
private Map<Instruction,Integer> |
instNumbers |
| Constructor and Description |
|---|
Coalesce(Map<Instruction,Integer> instNumbers) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
attempt(LiveAnalysis live,
Register r1,
Register r2)
Attempt to coalesce register r2 into register r1.
|
private boolean |
isLiveAtDef(Register r1,
Register r2,
LiveAnalysis live)
Is register r1 live at any def of register r2?
|
private boolean |
split(Register r1,
Register r2)
Is there an instruction r1 = split r2 or r2 = split r1??
|
private final Map<Instruction,Integer> instNumbers
Coalesce(Map<Instruction,Integer> instNumbers)
public boolean attempt(LiveAnalysis live, Register r1, Register r2)
live - liveness information for the IRr1 - the register that is the target of coalescing (i.e. the one that will remain)r2 - the register that we want to coalesce (i.e. the one that will be "removed")true if the transformation succeeded, false otherwise.private boolean isLiveAtDef(Register r1, Register r2, LiveAnalysis live)
PRECONDITION def-use chains must be computed and valid.
Note: this implementation is not efficient. The liveness data structures must be re-designed to support this efficiently.
r1 - the register that is checked for livenessr2 - the register whose defs are checked against livenesslive - live analysis phasetrue if the register is live at any point where the other
register is defined