org.jikesrvm.compilers.opt.ir.operand
Class LocationOperand

java.lang.Object
  extended by org.jikesrvm.compilers.opt.ir.operand.Operand
      extended by org.jikesrvm.compilers.opt.ir.operand.LocationOperand
All Implemented Interfaces:
OptConstants

public final class LocationOperand
extends Operand
implements OptConstants

Represents a location in memory. Used to keep track of memory aliasing.

See Also:
Operand

Field Summary
static int ALENGTH_ACCESS
          Enumeration of Access type
static int ARRAY_ACCESS
          Enumeration of Access type
(package private)  TypeReference arrayElementType
          Array element type that corresponds to the type of the array that contains this location; null if this is not an array access.
static int FIELD_ACCESS
          Enumeration of Access type
(package private)  FieldReference fieldRef
          Field that corresponds to this location; null if this is not a field access.
static int JTOC_ACCESS
          Enumeration of Access type
(package private)  Offset JTOCoffset
          JTOC index that corresponds to this location
static int METHOD_ACCESS
          Enumeration of Access type
(package private)  MethodOperand methOp
          Method operand that corresponds to this location; null if this is not a method access.
static int SPILL_ACCESS
          Enumeration of Access type
(package private)  int spillOffset
          Spill offset that corresponds to this location
(package private)  int type
          The type of this location.
 
Fields inherited from class org.jikesrvm.compilers.opt.ir.operand.Operand
instruction
 
Fields inherited from interface org.jikesrvm.compilers.opt.driver.OptConstants
EPILOGUE_BCI, EPILOGUE_BLOCK_BCI, EXTANT_ANALYSIS_BCI, INSTRUMENTATION_BCI, MAYBE, METHOD_COUNTER_BCI, NO, OSR_PROLOGUE, PROLOGUE_BCI, PROLOGUE_BLOCK_BCI, RECTIFY_BCI, RUNTIME_SERVICES_BCI, SSA_SYNTH_BCI, SYNCHRONIZED_MONITORENTER_BCI, SYNCHRONIZED_MONITOREXIT_BCI, SYNTH_CATCH_BCI, SYNTH_LOOP_VERSIONING_BCI, UNKNOWN_BCI, YES
 
Constructor Summary
LocationOperand()
          Constructs a new location operand for array length access.
LocationOperand(FieldReference loc)
          Constructs a new location operand with the given field.
LocationOperand(int index)
          Constructs a new location operand with the given spill offset.
LocationOperand(MethodOperand m)
          Constructs a new location operand with the given method
LocationOperand(Offset jtocOffset)
          Constructs a new location operand with the given JTOC offset
LocationOperand(RVMField loc)
          Constructs a new location operand with the given field
LocationOperand(TypeReference t)
          Constructs a new location operand with the given array element type.
 
Method Summary
private static boolean arrayMayBeAliased(TypeReference t1, TypeReference t2)
           
 LocationOperand asALengthAccess()
           
 LocationOperand asArrayAccess()
           
 LocationOperand asFieldAccess()
           
 LocationOperand asJTOCAccess()
           
 LocationOperand asMethodAccess()
           
 LocationOperand asSpillAccess()
           
 Operand copy()
          Return a new operand that is semantically equivalent to this.
 TypeReference getElementType()
           
 FieldReference getFieldRef()
           
 Offset getJTOCoffset()
           
 int getOffset()
           
 TypeReference getType()
          Return the TypeReference of the value represented by the operand.
 boolean isALengthAccess()
           
 boolean isArrayAccess()
           
 boolean isFieldAccess()
           
 boolean isJTOCAccess()
           
 boolean isMethodAccess()
           
 boolean isSpillAccess()
           
static boolean mayBeAliased(LocationOperand op1, LocationOperand op2)
          Returns true if operands op1 and op2 may be aliased.
 boolean mayBeVolatile()
          Is the accessed location possibly volatile?
 boolean similar(Operand op)
          Are two operands semantically equivalent?
 String toString()
          Returns the string representation of this operand.
 
Methods inherited from class org.jikesrvm.compilers.opt.ir.operand.Operand
asAddressConstant, asBlock, asBranch, asClassConstant, asCondition, asDoubleConstant, asFloatConstant, asIntConstant, asLocation, asLongConstant, asMemory, asMethod, asNullConstant, asObjectConstant, asRegister, asStackLocation, asStringConstant, asTIBConstant, asType, conservativelyApproximates, getIndexInInstruction, isAddress, isAddressConstant, isBlock, isBranch, isClassConstant, isConstant, isDefinitelyNull, isDouble, isDoubleConstant, isFloat, isFloatConstant, isInt, isIntConstant, isIntLike, isLocation, isLong, isLongConstant, isMemory, isMethod, isMovableObjectConstant, isNullConstant, isObjectConstant, isRef, isRegister, isStackLocation, isStringConstant, isTIBConstant, isTrueGuard, isType, meet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FIELD_ACCESS

public static final int FIELD_ACCESS
Enumeration of Access type

See Also:
Constant Field Values

ARRAY_ACCESS

public static final int ARRAY_ACCESS
Enumeration of Access type

See Also:
Constant Field Values

JTOC_ACCESS

public static final int JTOC_ACCESS
Enumeration of Access type

See Also:
Constant Field Values

SPILL_ACCESS

public static final int SPILL_ACCESS
Enumeration of Access type

See Also:
Constant Field Values

ALENGTH_ACCESS

public static final int ALENGTH_ACCESS
Enumeration of Access type

See Also:
Constant Field Values

METHOD_ACCESS

public static final int METHOD_ACCESS
Enumeration of Access type

See Also:
Constant Field Values

type

int type
The type of this location.


fieldRef

FieldReference fieldRef
Field that corresponds to this location; null if this is not a field access.


methOp

MethodOperand methOp
Method operand that corresponds to this location; null if this is not a method access.


arrayElementType

TypeReference arrayElementType
Array element type that corresponds to the type of the array that contains this location; null if this is not an array access.


JTOCoffset

Offset JTOCoffset
JTOC index that corresponds to this location. -1 if this is not a JTOC access.


spillOffset

int spillOffset
Spill offset that corresponds to this location. -1 if this is not a spill access.

Constructor Detail

LocationOperand

public LocationOperand(FieldReference loc)
Constructs a new location operand with the given field.

Parameters:
loc - location

LocationOperand

public LocationOperand(RVMField loc)
Constructs a new location operand with the given field

Parameters:
loc - location

LocationOperand

public LocationOperand(MethodOperand m)
Constructs a new location operand with the given method

Parameters:
m - Method operand that corresponds to this location

LocationOperand

public LocationOperand(TypeReference t)
Constructs a new location operand with the given array element type.

Parameters:
t - Array element type

LocationOperand

public LocationOperand(Offset jtocOffset)
Constructs a new location operand with the given JTOC offset


LocationOperand

public LocationOperand(int index)
Constructs a new location operand with the given spill offset.


LocationOperand

public LocationOperand()
Constructs a new location operand for array length access.

Method Detail

getType

public TypeReference getType()
Description copied from class: Operand
Return the TypeReference of the value represented by the operand.

Overrides:
getType in class Operand
Returns:
this method shouldn't be called and will throw an OptimizingCompilerException

asFieldAccess

public LocationOperand asFieldAccess()

asArrayAccess

public LocationOperand asArrayAccess()

asJTOCAccess

public LocationOperand asJTOCAccess()

asSpillAccess

public LocationOperand asSpillAccess()

asALengthAccess

public LocationOperand asALengthAccess()

asMethodAccess

public LocationOperand asMethodAccess()

getFieldRef

public FieldReference getFieldRef()

getElementType

public TypeReference getElementType()

getJTOCoffset

public Offset getJTOCoffset()

getOffset

public int getOffset()

isFieldAccess

public boolean isFieldAccess()

isArrayAccess

public boolean isArrayAccess()

isJTOCAccess

public boolean isJTOCAccess()

isSpillAccess

public boolean isSpillAccess()

isALengthAccess

public boolean isALengthAccess()

isMethodAccess

public boolean isMethodAccess()

mayBeVolatile

public boolean mayBeVolatile()
Is the accessed location possibly volatile?


copy

public Operand copy()
Description copied from class: Operand
Return a new operand that is semantically equivalent to this.

Specified by:
copy in class Operand
Returns:
a copy of this

arrayMayBeAliased

private static boolean arrayMayBeAliased(TypeReference t1,
                                         TypeReference t2)

mayBeAliased

public static boolean mayBeAliased(LocationOperand op1,
                                   LocationOperand op2)
Returns true if operands op1 and op2 may be aliased.

Parameters:
op1 - the first operand
op2 - the second operand
Returns:
true if the operands might be aliased or false if they are definitely not aliased

similar

public boolean similar(Operand op)
Description copied from class: Operand
Are two operands semantically equivalent?

Specified by:
similar in class Operand
Parameters:
op - other operand
Returns:
true if this and op are semantically equivalent or false if they are not.

toString

public String toString()
Returns the string representation of this operand.

Overrides:
toString in class Object
Returns:
a string representation of this operand.