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

java.lang.Object
  extended by org.jikesrvm.compilers.opt.ir.operand.Operand
      extended by org.jikesrvm.compilers.opt.ir.operand.MemoryOperand

public final class MemoryOperand
extends Operand

A memory operand. Used to represent complex addressing modes on CISC machines. A memory operand contains some set of other operands that are used in the address calculation.

May contain 0, 1, or 2 RegisterOperands as well as a scale factor and displacement.

The effective address represented by this operand is:

     [base] + [index]*(2^scale) + disp
 

See Also:
Operand

Field Summary
 RegisterOperand base
          The base register (may be null)
 Offset disp
          The displacement
 Operand guard
          The guard operand that validates this memory access
 RegisterOperand index
          The index register (may be null)
 LocationOperand loc
          The location operand describing this memory access
 byte scale
          The scale value (log power of 2) valid values are 0,1,2,3
 byte size
          Number of bytes being accessed (1,2,4,8)
 
Fields inherited from class org.jikesrvm.compilers.opt.ir.operand.Operand
instruction
 
Constructor Summary
MemoryOperand(RegisterOperand base, RegisterOperand index, byte scale, Offset disp, byte size, LocationOperand loc, Operand guard)
           
 
Method Summary
static MemoryOperand B(RegisterOperand base, byte size, LocationOperand loc, Operand guard)
           
static MemoryOperand BD(RegisterOperand base, Offset disp, byte size, LocationOperand loc, Operand guard)
           
static MemoryOperand BI(RegisterOperand base, RegisterOperand index, byte size, LocationOperand loc, Operand guard)
           
static MemoryOperand BID(RegisterOperand base, RegisterOperand index, Offset disp, byte size, LocationOperand loc, Operand guard)
           
static MemoryOperand BIS(RegisterOperand base, RegisterOperand index, byte scale, byte size, LocationOperand loc, Operand guard)
           
 Operand copy()
          Return a new operand that is semantically equivalent to this.
static MemoryOperand D(Address disp, byte size, LocationOperand loc, Operand guard)
           
static MemoryOperand I(RegisterOperand base, byte size, LocationOperand loc, Operand guard)
           
 boolean similar(Operand op)
          Are two operands semantically equivalent?
 String toString()
          Return a string rep of the operand (ie the effective address)
 
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, getType, 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

loc

public LocationOperand loc
The location operand describing this memory access


guard

public Operand guard
The guard operand that validates this memory access


base

public RegisterOperand base
The base register (may be null)


index

public RegisterOperand index
The index register (may be null)


scale

public byte scale
The scale value (log power of 2) valid values are 0,1,2,3


disp

public Offset disp
The displacement


size

public byte size
Number of bytes being accessed (1,2,4,8)

Constructor Detail

MemoryOperand

public MemoryOperand(RegisterOperand base,
                     RegisterOperand index,
                     byte scale,
                     Offset disp,
                     byte size,
                     LocationOperand loc,
                     Operand guard)
Method Detail

B

public static MemoryOperand B(RegisterOperand base,
                              byte size,
                              LocationOperand loc,
                              Operand guard)

BI

public static MemoryOperand BI(RegisterOperand base,
                               RegisterOperand index,
                               byte size,
                               LocationOperand loc,
                               Operand guard)

BD

public static MemoryOperand BD(RegisterOperand base,
                               Offset disp,
                               byte size,
                               LocationOperand loc,
                               Operand guard)

BID

public static MemoryOperand BID(RegisterOperand base,
                                RegisterOperand index,
                                Offset disp,
                                byte size,
                                LocationOperand loc,
                                Operand guard)

BIS

public static MemoryOperand BIS(RegisterOperand base,
                                RegisterOperand index,
                                byte scale,
                                byte size,
                                LocationOperand loc,
                                Operand guard)

D

public static MemoryOperand D(Address disp,
                              byte size,
                              LocationOperand loc,
                              Operand guard)

I

public static MemoryOperand I(RegisterOperand base,
                              byte size,
                              LocationOperand loc,
                              Operand guard)

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

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()
Return a string rep of the operand (ie the effective address)

Overrides:
toString in class Object