org.jikesrvm.compilers.opt.escape
Class ShortArrayReplacer

java.lang.Object
  extended by org.jikesrvm.compilers.opt.escape.ShortArrayReplacer
All Implemented Interfaces:
AggregateReplacer

final class ShortArrayReplacer
extends Object
implements AggregateReplacer

Class that performs scalar replacement of short arrays


Field Summary
private  IR ir
          the governing IR
private  Register reg
          the register holding the array reference
private  int size
          number of elements in the array
private  RVMArray vmArray
          type of the array
 
Constructor Summary
private ShortArrayReplacer(Register r, RVMArray a, int s, IR i)
           
 
Method Summary
private static boolean containsUnsupportedUse(IR ir, Register reg, int size, RVMArray vmArray, Set<Register> visited)
          Some cases we don't handle yet.
static ShortArrayReplacer getReplacer(Instruction inst, IR ir)
          Return an object representing this transformation for a given allocation site
private  void scalarReplace(RegisterOperand use, RegisterOperand[] scalars, Set<Register> visited)
          Replace a given use of an array with its scalar equivalent.
 void transform()
          Perform the transformation
private  void transform2(Register reg, Instruction defI, RegisterOperand[] scalars)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

size

private final int size
number of elements in the array


vmArray

private final RVMArray vmArray
type of the array


reg

private final Register reg
the register holding the array reference


ir

private final IR ir
the governing IR

Constructor Detail

ShortArrayReplacer

private ShortArrayReplacer(Register r,
                           RVMArray a,
                           int s,
                           IR i)
Parameters:
r - the register holding the array reference
a - the type of the array to replace
s - the size of the array to replace
i - the IR
Method Detail

getReplacer

public static ShortArrayReplacer getReplacer(Instruction inst,
                                             IR ir)
Return an object representing this transformation for a given allocation site

Parameters:
inst - the allocation site
ir -
Returns:
the object, or null if illegal

transform

public void transform()
Description copied from interface: AggregateReplacer
Perform the transformation

Specified by:
transform in interface AggregateReplacer

transform2

private void transform2(Register reg,
                        Instruction defI,
                        RegisterOperand[] scalars)

scalarReplace

private void scalarReplace(RegisterOperand use,
                           RegisterOperand[] scalars,
                           Set<Register> visited)
Replace a given use of an array with its scalar equivalent.

Parameters:
use - the use to replace
scalars - an array of scalar register operands to replace the array with

containsUnsupportedUse

private static boolean containsUnsupportedUse(IR ir,
                                              Register reg,
                                              int size,
                                              RVMArray vmArray,
                                              Set<Register> visited)
Some cases we don't handle yet. TODO: handle them.

Parameters:
ir - the governing IR
reg - the register in question
size - the size of the array to scalar replace.