org.jikesrvm.compilers.opt.regalloc
Class Coalesce

java.lang.Object
  extended by org.jikesrvm.compilers.opt.regalloc.Coalesce

 class Coalesce
extends Object

Utility to help coalesce registers.

See Also:
CoalesceMoves

Constructor Summary
Coalesce()
           
 
Method Summary
static boolean attempt(IR ir, LiveAnalysis live, Register r1, Register r2)
          Attempt to coalesce register r2 into register r1.
private static boolean isLiveAtDef(Register r1, Register r2, LiveAnalysis live)
          Is register r1 live at any def of register r2?
private static boolean split(Register r1, Register r2)
          Is there an instruction r1 = split r2 or r2 = split r1??
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Coalesce

Coalesce()
Method Detail

attempt

public static boolean attempt(IR ir,
                              LiveAnalysis live,
                              Register r1,
                              Register r2)
Attempt to coalesce register r2 into register r1. If this is legal, PRECONDITION def-use chains must be computed and valid. PRECONDITION instructions are numbered, with numbers stored in Instruction.scratch

Parameters:
ir - the governing IR
live - liveness information for the IR
r1 -
r2 -
Returns:
true if the transformation succeeded, false otherwise.

isLiveAtDef

private static boolean isLiveAtDef(Register r1,
                                   Register r2,
                                   LiveAnalysis live)
Is register r1 live at any def of register r2?

PRECONDITION def-use chains must be computed and valid. PRECONDITION instructions are numbered, with numbers stored in Instruction.scratch

Note: this implementation is not efficient. The liveness data structures must be re-designed to support this efficiently.


split

private static boolean split(Register r1,
                             Register r2)
Is there an instruction r1 = split r2 or r2 = split r1??