|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.android.dx.dex.code.DalvInsn
public abstract class DalvInsn
Base class for Dalvik instructions.
| Constructor Summary | |
|---|---|
DalvInsn(Dop opcode,
SourcePosition position,
RegisterSpecList registers)
Constructs an instance. |
|
| Method Summary | |
|---|---|
protected abstract String |
argString()
Gets the string form for any arguments to this instance. |
abstract int |
codeSize()
Gets the size of this instruction, in 16-bit code units. |
DalvInsn |
expandedPrefix(BitSet compatRegs)
Gets the instruction prefix required, if any, to use in an expanded version of this instance. |
DalvInsn |
expandedSuffix(BitSet compatRegs)
Gets the instruction suffix required, if any, to use in an expanded version of this instance. |
DalvInsn |
expandedVersion(BitSet compatRegs)
Gets the instruction that is equivalent to this one, except that it replaces incompatible registers with sequential registers starting at 0 (storing the result, if any, in register
0 as well). |
int |
getAddress()
Gets the output address of this instruction, if it is known. |
DalvInsn |
getLowRegVersion()
Gets the instruction that is equivalent to this one, except that it uses sequential registers starting at 0 (storing
the result, if any, in register 0 as well). |
int |
getMinimumRegisterRequirement(BitSet compatRegs)
Gets the minimum distinct registers required for this instruction. |
int |
getNextAddress()
Gets the address immediately after this instance. |
Dop |
getOpcode()
Gets the opcode. |
SourcePosition |
getPosition()
Gets the source position. |
RegisterSpecList |
getRegisters()
Gets the register list for this instruction. |
boolean |
hasAddress()
Gets whether the address of this instruction is known. |
boolean |
hasResult()
Returns whether this instance's opcode uses a result register. |
String |
identifierString()
Gets the short identifier for this instruction. |
String |
listingString(String prefix,
int width,
boolean noteIndices)
Returns the string form of this instance suitable for inclusion in a human-oriented listing dump. |
protected abstract String |
listingString0(boolean noteIndices)
Helper for listingString(java.lang.String, int, boolean), which returns the string
form of this instance suitable for inclusion in a
human-oriented listing dump, not including the instruction
address and without respect for any output formatting. |
static SimpleInsn |
makeMove(SourcePosition position,
RegisterSpec dest,
RegisterSpec src)
Makes a move instruction, appropriate and ideal for the given arguments. |
void |
setAddress(int address)
Sets the output address. |
String |
toString()
|
abstract DalvInsn |
withOpcode(Dop opcode)
Returns an instance that is just like this one, except that its opcode is replaced by the one given, and its address is reset. |
abstract DalvInsn |
withRegisterOffset(int delta)
Returns an instance that is just like this one, except that all register references have been offset by the given delta, and its address is reset. |
abstract DalvInsn |
withRegisters(RegisterSpecList registers)
Returns an instance that is just like this one, except that the register list is replaced by the given one, and its address is reset. |
abstract void |
writeTo(AnnotatedOutput out)
Writes this instance to the given output. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DalvInsn(Dop opcode,
SourcePosition position,
RegisterSpecList registers)
-1).
Note: In the unlikely event that an instruction takes
absolutely no registers (e.g., a nop or a
no-argument no-result static method call), then the given
register list may be passed as RegisterSpecList.EMPTY.
opcode - the opcode; one of the constants from Dopsposition - non-null; source positionregisters - non-null; register list, including a
result register if appropriate (that is, registers may be either
ins and outs)| Method Detail |
|---|
public static SimpleInsn makeMove(SourcePosition position,
RegisterSpec dest,
RegisterSpec src)
position - non-null; source position informationdest - non-null; destination registersrc - non-null; source register
non-null; an appropriately-constructed instancepublic final String toString()
toString in class Objectpublic final boolean hasAddress()
getAddress(),
setAddress(int)public final int getAddress()
RuntimeException if it has not yet been set.
>= 0; the output addresssetAddress(int)public final Dop getOpcode()
non-null; the opcodepublic final SourcePosition getPosition()
non-null; the source positionpublic final RegisterSpecList getRegisters()
non-null; the registerspublic final boolean hasResult()
getOpcode().hasResult().
true iff this opcode uses a result registerpublic final int getMinimumRegisterRequirement(BitSet compatRegs)
compatRegs - non-null; set of compatible registers
>= 0; the minimum distinct register requirementpublic DalvInsn getLowRegVersion()
0 (storing
the result, if any, in register 0 as well).
non-null; the replacementpublic DalvInsn expandedPrefix(BitSet compatRegs)
compatRegs - non-null; set of compatible registers
null-ok; the prefix, if anyexpandedVersion(java.util.BitSet)public DalvInsn expandedSuffix(BitSet compatRegs)
compatRegs - non-null; set of compatible registers
null-ok; the suffix, if anyexpandedVersion(java.util.BitSet)public DalvInsn expandedVersion(BitSet compatRegs)
0 (storing the result, if any, in register
0 as well). The sequence of instructions from
expandedPrefix(java.util.BitSet) and expandedSuffix(java.util.BitSet) (if non-null)
surrounding the result of a call to this method are the expanded
transformation of this instance, and it is guaranteed that the
number of low registers used will be the number returned by
getMinimumRegisterRequirement(java.util.BitSet).
compatRegs - non-null; set of compatible registers
non-null; the replacementpublic final String identifierString()
non-null; the identifier
public final String listingString(String prefix,
int width,
boolean noteIndices)
null
if this instance should not appear in a listing.
prefix - non-null; prefix before the address; each follow-on
line will be indented to match as wellwidth - >= 0; the width of the output or 0 for
unlimited widthnoteIndices - whether to include an explicit notation of
constant pool indices
null-ok; the string form or null if this
instance should not appear in a listingpublic final void setAddress(int address)
address - >= 0; the output addresspublic final int getNextAddress()
>= 0; the next addresspublic abstract int codeSize()
>= 0; the code size of this instructionpublic abstract void writeTo(AnnotatedOutput out)
out - non-null; where to write topublic abstract DalvInsn withOpcode(Dop opcode)
opcode - non-null; the new opcode
non-null; an appropriately-constructed instancepublic abstract DalvInsn withRegisterOffset(int delta)
delta - the amount to offset register references by
non-null; an appropriately-constructed instancepublic abstract DalvInsn withRegisters(RegisterSpecList registers)
registers - non-null; new register list
non-null; an appropriately-constructed instanceprotected abstract String argString()
null-ok; the string version of any arguments or
null if there are noneprotected abstract String listingString0(boolean noteIndices)
listingString(java.lang.String, int, boolean), which returns the string
form of this instance suitable for inclusion in a
human-oriented listing dump, not including the instruction
address and without respect for any output formatting. This
method should return null if this instance should
not appear in a listing.
noteIndices - whether to include an explicit notation of
constant pool indices
null-ok; the listing string
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||