|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jikesrvm.compilers.opt.ir.operand.Operand org.jikesrvm.compilers.opt.ir.operand.RegisterOperand
public final class RegisterOperand
A symbolic or physical register. A wrapper around an Register that may contain program-point specific information about the value denoted by the Register.
TODO: This class is due for a refactor into subclasses to split out the symbolic & physical registers and to create special behavior for symbolic registers used as phi operands and as validation (guard) operands.
Operand
Field Summary | |
---|---|
private static byte |
BOUNDS_CHECK
Guard operand that originates from a bounds-check |
private static int |
DECLARED_TYPE
The type has been declared as obtained from a getfield, getstatic, putfield, putstatic, array load |
private static byte |
EXTANT
is this an extant object? |
private byte |
flags
Type of a RegisterOperand can be in one of three states: a- declared: the type obtained from a getfield,getstatic,putfield,putstatic,array load b- precise: obtained from a NEW. |
private byte |
flags2
Some bits used to characterize guards. |
private short |
info
16bit scratch word that can be used for different optimizations. |
private static byte |
NON_VOLATILE
is this a non-volatile physical register? |
private static byte |
NOT_TAKEN
guard operand that represents a not taken branch |
private static byte |
NULL_CHECK
Guard operand that originates from a null-check |
private static byte |
PARAMETER
the register operand is for a parameter |
private static int |
POSITIVE
Is the contents of the int-like register always positive? |
private static int |
PRECISE_TYPE
We know precisely the type as it was create by a NEW |
Register |
register
Register object that this operand uses. |
Object |
scratchObject
Optimizations can use it for different purposes, as long as they are not used simultaneously |
private static byte |
TAKEN
guard operand that represents a taken branch |
TypeReference |
type
Inferred data type of the contents of the register. |
Fields inherited from class org.jikesrvm.compilers.opt.ir.operand.Operand |
---|
instruction |
Constructor Summary | |
---|---|
RegisterOperand(Register reg,
TypeReference typ)
Constructs a new register operand with the given register and data type. |
|
RegisterOperand(Register reg,
TypeReference typ,
byte inFlags,
boolean isPrecise,
boolean isDeclared)
Constructs a new register operand with the given register, data type and flags. |
Method Summary | |
---|---|
void |
addFlags(byte inFlag)
Merge two sets of register flags |
void |
append(RegisterOperand next)
Sets scratch object of the register operand to parameter. |
void |
clearBoundsCheck()
Clear this from being a guard operand from a bounds check |
void |
clearDeclaredType()
Clear this register from having a declared type |
void |
clearExtant()
Clear this register from holding an extant value |
void |
clearFlags()
Clear the flags of a register |
void |
clearNonVolatile()
Set this register as being volatile |
void |
clearNotTaken()
Clear this from being a guard operand from a not taken branch |
void |
clearNullCheck()
Clear this from being a guard operand from a null check |
void |
clearParameter()
Clear this register from being used to hold parameters |
void |
clearPreciseType()
Clear this register from having a precise type |
void |
clearTaken()
Clear this from being a guard operand from a taken branch |
Operand |
copy()
Returns a copy of this register operand as an operand |
RegisterOperand |
copyD2D()
Returns a copy of this def register operand as a def. |
RegisterOperand |
copyD2U()
Returns a copy of this def register operand as a use. |
RegisterOperand |
copyRO()
Returns a copy of this register operand as a register operand. |
void |
copyType(RegisterOperand rhs)
Copy type information from the given operand into this one including flag information on whether this is a precise type or not |
RegisterOperand |
copyU2D()
Returns a copy of this use register operand as a def. |
RegisterOperand |
copyU2U()
Returns a copy of this use register operand as another use reg operand. |
byte |
getFlags()
Return a byte encoding register flags |
short |
getInfo()
Get info scratch short |
RegisterOperand |
getNext()
Returns the scratch object of the register operand |
Register |
getRegister()
|
TypeReference |
getType()
Return the TypeReference of the value represented by the operand. |
boolean |
hasLessConservativeFlags(RegisterOperand other)
Return true if we have any bits set (flag true) that other doesn't. |
boolean |
isAddress()
Does the operand represent a value of the address data type? |
boolean |
isBoundsCheck()
Is this a guard operand from a bounds check? |
boolean |
isDeclaredOrPreciseType()
Is this register a declared or a precise type? |
boolean |
isDeclaredType()
Does this register have a declared type? |
boolean |
isDefinitelyNull()
Does the operand definitely represent null ? |
boolean |
isDouble()
Does the operand represent a value of the double data type? |
boolean |
isExtant()
Is this register known to contain either NULL or an object whose class was fully loaded before the current method was called? |
boolean |
isFloat()
Does the operand represent a value of the float data type? |
boolean |
isInt()
Does the operand represent a value of the int data type? |
boolean |
isIntLike()
Does the operand represent a value of an int-like data type? |
boolean |
isLong()
Does the operand represent a value of the long data type? |
boolean |
isNonVolatile()
Is this a volatile register? |
boolean |
isNotTaken()
Is this a guard operand from a not taken branch? |
boolean |
isNullCheck()
Is this a guard operand from a null check? |
boolean |
isParameter()
Does this register hold a parameter |
boolean |
isPositiveInt()
Is this register a positive int? |
boolean |
isPreciseType()
Do we know the precise type of this register? |
boolean |
isRef()
Does the operand represent a value of the reference data type? |
boolean |
isTaken()
Is this a guard operand from a taken branch? |
void |
meetInheritableFlags(RegisterOperand other)
Currently all flags are "meetable", so mask flags together |
void |
refine(TypeReference t)
Refine the type of the register to t if t is a more precise type than the register currently holds |
void |
setBoundsCheck()
Set this as a guard operand from a bounds check |
void |
setDeclaredType()
Set this register as having a declared type |
void |
setExtant()
Set this register as holding an extant object (or NULL) (ie, an object whose class was fully loaded before the current method was called). |
void |
setInfo(short value)
Set info scratch short |
void |
setInheritableFlags(RegisterOperand src)
Currently all flags are inheritable, so copy all flags from src |
void |
setNext(RegisterOperand Next)
Sets scratch object of the register operand to parameter. |
void |
setNonVolatile()
Set this register as being non-volatile |
void |
setNotTaken()
Set this a guard operand from a not taken branch |
void |
setNullCheck()
Set this as being a guard operand from a null check |
void |
setParameter()
Set this register as being used to hold parameters |
void |
setPositiveInt()
Set this register as being a positive int |
void |
setPreciseType()
Set this register as having a precise type |
void |
setPreciseType(TypeReference t)
Set the TypeReference of the value represented by the operand and
make the type precise. |
void |
setRegister(Register register)
Modify the register |
void |
setTaken()
Set this a guard operand from a taken branch |
void |
setType(TypeReference t)
Set the TypeReference of the value represented by the operand. |
boolean |
similar(Operand op)
Returns whether the given operand is a register operand and has the same register object. |
String |
toString()
Returns the string representation of this operand. |
private void |
verifyPreciseType()
|
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, isAddressConstant, isBlock, isBranch, isClassConstant, isConstant, isDoubleConstant, isFloatConstant, isIntConstant, isLocation, isLongConstant, isMemory, isMethod, isMovableObjectConstant, isNullConstant, isObjectConstant, 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 |
---|
public Register register
public TypeReference type
public Object scratchObject
private short info
private byte flags
private static final int DECLARED_TYPE
private static final int PRECISE_TYPE
private static final int POSITIVE
private static final byte PARAMETER
private static final byte NON_VOLATILE
private static final byte EXTANT
private byte flags2
private static final byte TAKEN
private static final byte NOT_TAKEN
private static final byte BOUNDS_CHECK
private static final byte NULL_CHECK
Constructor Detail |
---|
public RegisterOperand(Register reg, TypeReference typ)
reg
- register objecttyp
- data typepublic RegisterOperand(Register reg, TypeReference typ, byte inFlags, boolean isPrecise, boolean isDeclared)
reg
- register objecttyp
- data typeinFlags
- to set for this registerisPrecise
- is this a precise typeisDeclared
- is this a declared typeMethod Detail |
---|
public Operand copy()
copy
in class Operand
this
public RegisterOperand copyRO()
NOTE: preserves the flags, info and scratchObject. Preserving is required in all cases as several phases also depend on scratch and/or scratchObject being copied
public RegisterOperand copyU2U()
public RegisterOperand copyD2U()
public RegisterOperand copyU2D()
public RegisterOperand copyD2D()
public boolean similar(Operand op)
similar
in class Operand
op
- operand to compare against
true
if this
and op
are semantically equivalent or false
if they are not.public void copyType(RegisterOperand rhs)
rhs
- the type to copy information frompublic boolean isIntLike()
Operand
isIntLike
in class Operand
true
if the data type of this
is int-like as defined by TypeReference.isIntLikeType()
or false
if it is not.public boolean isInt()
Operand
isInt
in class Operand
true
if the data type of this
is an int as defined by TypeReference.isIntType()
or false
if it is not.public boolean isLong()
Operand
isLong
in class Operand
true
if the data type of this
is a long as defined by TypeReference.isLongType()
or false
if it is not.public boolean isFloat()
Operand
isFloat
in class Operand
true
if the data type of this
is a float as defined by TypeReference.isFloatType()
or false
if it is not.public boolean isDouble()
Operand
isDouble
in class Operand
true
if the data type of this
is a double as defined by TypeReference.isDoubleType()
or false
if it is not.public boolean isRef()
Operand
isRef
in class Operand
true
if the data type of this
is a reference as defined by TypeReference.isReferenceType()
or false
if it is not.public boolean isAddress()
Operand
isAddress
in class Operand
true
if the data type of this
is an address as defined by TypeReference.isAddressType()
or false
if it is not.public boolean isDefinitelyNull()
Operand
null
?
isDefinitelyNull
in class Operand
true
if the operand definitely represents
null
or false
if it does not.public boolean isParameter()
public void setParameter()
public void clearParameter()
public boolean isNonVolatile()
public void setNonVolatile()
public void clearNonVolatile()
public boolean isExtant()
public void setExtant()
public void clearExtant()
public boolean isDeclaredType()
public void setDeclaredType()
public void clearDeclaredType()
private void verifyPreciseType()
public boolean isPreciseType()
public void setPreciseType()
public void clearPreciseType()
public boolean isDeclaredOrPreciseType()
public boolean isPositiveInt()
public void setPositiveInt()
public byte getFlags()
public void clearFlags()
public void addFlags(byte inFlag)
public void setInheritableFlags(RegisterOperand src)
public void meetInheritableFlags(RegisterOperand other)
public boolean hasLessConservativeFlags(RegisterOperand other)
public boolean isTaken()
public void setTaken()
public void clearTaken()
public boolean isNotTaken()
public void setNotTaken()
public void clearNotTaken()
public boolean isBoundsCheck()
public void setBoundsCheck()
public void clearBoundsCheck()
public boolean isNullCheck()
public void setNullCheck()
public void clearNullCheck()
public short getInfo()
public void setInfo(short value)
public void setNext(RegisterOperand Next)
public void append(RegisterOperand next)
public RegisterOperand getNext()
public String toString()
toString
in class Object
public void setRegister(Register register)
public Register getRegister()
public void setType(TypeReference t)
TypeReference
of the value represented by the operand.
t
- the inferred data type of the contents of the registerpublic void setPreciseType(TypeReference t)
TypeReference
of the value represented by the operand and
make the type precise.
t
- the inferred data type of the contents of the registerpublic TypeReference getType()
TypeReference
of the value represented by the operand.
getType
in class Operand
public void refine(TypeReference t)
t
- type to try to refine to
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |