public final class RegisterSpec extends java.lang.Object implements TypeBearer, ToHuman, java.lang.Comparable<RegisterSpec>
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
PREFIX
non-null; string to prefix register numbers with |
| Modifier and Type | Method and Description |
|---|---|
static void |
clearInternTable() |
int |
compareTo(RegisterSpec other)
Compares by (in priority order) register number, unwrapped type
(that is types not
TypeBearers, and local info. |
boolean |
equals(java.lang.Object other) |
boolean |
equalsUsingSimpleType(RegisterSpec other)
Like
equals, but only consider the simple types of the
registers. |
int |
getBasicFrameType()
Gets the basic type corresponding to this instance's frame type.
|
int |
getBasicType()
Gets the basic type corresponding to this instance.
|
int |
getCategory()
Gets the category of this instance's type.
|
TypeBearer |
getFrameType()
Gets the frame type corresponding to this type.
|
LocalItem |
getLocalItem()
Gets the variable info associated with this instance, if any.
|
int |
getNextReg()
Gets the next available register number after the one in this
instance.
|
int |
getReg()
Gets the register number.
|
Type |
getType()
Gets the type associated with this instance.
|
TypeBearer |
getTypeBearer()
Gets the type (or actual value) which is loaded from or stored
to the register associated with this instance.
|
int |
hashCode() |
RegisterSpec |
intersect(RegisterSpec other,
boolean localPrimary)
Returns an instance that is the intersection between this instance
and the given one, if any.
|
boolean |
isCategory1()
Gets whether this instance's type is category 1.
|
boolean |
isCategory2()
Gets whether this instance's type is category 2.
|
boolean |
isConstant()
Returns whether this instance represents a constant value.
|
boolean |
isEvenRegister() |
static RegisterSpec |
make(int reg,
TypeBearer type)
Returns an instance for the given register number and type, with
no variable info.
|
static RegisterSpec |
make(int reg,
TypeBearer type,
LocalItem local)
Returns an instance for the given register number, type, and
variable info.
|
static RegisterSpec |
makeLocalOptional(int reg,
TypeBearer type,
LocalItem local)
Returns an instance for the given register number, type, and
variable info.
|
boolean |
matchesVariable(RegisterSpec other)
Like
equalsUsingSimpleType(com.android.dx.rop.code.RegisterSpec) but ignoring the register number. |
java.lang.String |
regString()
Gets the string form for just the register number of this instance.
|
static java.lang.String |
regString(int reg)
Gets the string form for the given register number.
|
java.lang.String |
toHuman()
Return the "human" string form of this instance.
|
java.lang.String |
toString() |
RegisterSpec |
withLocalItem(LocalItem local)
Returns an instance that is identical to this one except that the
local variable is as specified in the parameter.
|
RegisterSpec |
withOffset(int delta)
Returns an instance that is identical to this one, except that the
register number is offset by the given amount.
|
RegisterSpec |
withReg(int newReg)
Returns an instance that is identical to this one, except that the
register number is replaced by the given one.
|
RegisterSpec |
withSimpleType()
Returns an instance that is identical to this one, except that
the type bearer is replaced by the actual underlying type
(thereby stripping off non-type information) with any
initialization information stripped away as well.
|
RegisterSpec |
withType(TypeBearer newType)
Returns an instance that is identical to this one, except that
the type is replaced by the given one.
|
public static final java.lang.String PREFIX
non-null; string to prefix register numbers withpublic static RegisterSpec make(int reg, TypeBearer type)
reg - >= 0; the register numbertype - non-null; the type (or possibly actual value) which
is loaded from or stored to the indicated registernon-null; an appropriately-constructed instancepublic static RegisterSpec make(int reg, TypeBearer type, LocalItem local)
reg - >= 0; the register numbertype - non-null; the type (or possibly actual value) which
is loaded from or stored to the indicated registerlocal - non-null; the associated local variablenon-null; an appropriately-constructed instancepublic static RegisterSpec makeLocalOptional(int reg, TypeBearer type, LocalItem local)
reg - >= 0; the register numbertype - non-null; the type (or possibly actual value) which
is loaded from or stored to the indicated registerlocal - null-ok; the associated variable info or null for
nonenon-null; an appropriately-constructed instancepublic static java.lang.String regString(int reg)
reg - >= 0; the register numbernon-null; the string formpublic boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic boolean equalsUsingSimpleType(RegisterSpec other)
equals, but only consider the simple types of the
registers. That is, this compares getType() on the types
to ignore whatever arbitrary extra stuff might be carried around
by an outer TypeBearer.other - null-ok; spec to compare totrue iff this and other are equal
in the stated waypublic boolean matchesVariable(RegisterSpec other)
equalsUsingSimpleType(com.android.dx.rop.code.RegisterSpec) but ignoring the register number.
This is useful to determine if two instances refer to the "same"
local variable.other - null-ok; spec to compare totrue iff this and other are equal
in the stated waypublic int compareTo(RegisterSpec other)
TypeBearers, and local info.compareTo in interface java.lang.Comparable<RegisterSpec>other - non-null; spec to compare to-1..1; standard result of comparisonpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toHuman()
toString().public Type getType()
getType in interface TypeBearernon-null; the typepublic TypeBearer getFrameType()
this, except if Type.isIntlike() on the underlying
type returns true but the underlying type is not in
fact Type.INT, in which case this method returns an instance
whose underlying type is INT.getFrameType in interface TypeBearernon-null; the frame type for this instancepublic final int getBasicType()
getBasicType in interface TypeBearerBT_* constants
defined by Typepublic final int getBasicFrameType()
getFrameType().getBasicType(), and
is the same as calling getFrameType() unless this
instance is an int-like type, in which case this method returns
BT_INT.getBasicFrameType in interface TypeBearerBT_* constants
defined by TypeTypeBearer.getBasicType(),
TypeBearer.getFrameType()public final boolean isConstant()
isConstant in interface TypeBearertrue if this instance represents a constant value
and false if notpublic int getReg()
>= 0; the register numberpublic TypeBearer getTypeBearer()
non-null; the typepublic LocalItem getLocalItem()
null-ok; the variable info, or null if this
instance has nonepublic int getNextReg()
>= 0; the required registers sizepublic int getCategory()
getType().getCategory().1..2; the category of this instance's typeisCategory1(),
isCategory2()public boolean isCategory1()
getType().isCategory1().getCategory(),
isCategory2()public boolean isCategory2()
getType().isCategory2().getCategory(),
isCategory1()public java.lang.String regString()
non-null; the register string formpublic RegisterSpec intersect(RegisterSpec other, boolean localPrimary)
other is null, then the result
is null.
null. Otherwise, the register number of the
intersection is the same as the one in the two instances.getType() are not
equals(), then the intersection is null.getTypeBearer()
are equals(), then the intersection's type bearer
is the one from this instance. Otherwise, the intersection's
type bearer is the getType() of this instance.equals(), then the local info
of the intersection is the local info of this instance. Otherwise,
the local info of the intersection is null.other - null-ok; instance to intersect with (or null)localPrimary - whether local variables are primary to the
intersection; if true, then the only non-null
results occur when registers being intersected have equal local
infos (or both have null local infos)null-ok; the intersectionpublic RegisterSpec withReg(int newReg)
newReg - >= 0; the new register numbernon-null; an appropriately-constructed instancepublic RegisterSpec withType(TypeBearer newType)
newType - non-null; the new typenon-null; an appropriately-constructed instancepublic RegisterSpec withOffset(int delta)
delta - the amount to offset the register number bynon-null; an appropriately-constructed instancepublic RegisterSpec withSimpleType()
non-null; an appropriately-constructed instancepublic RegisterSpec withLocalItem(LocalItem local)
local - null-ok; the local item or null for nonepublic boolean isEvenRegister()
public static void clearInternTable()
Copyright © 2020. All Rights Reserved.