Package com.android.dx.dex.code
Class TargetInsn
java.lang.Object
com.android.dx.dex.code.DalvInsn
com.android.dx.dex.code.FixedSizeInsn
com.android.dx.dex.code.TargetInsn
Instruction which has a single branch target.
-
Constructor Summary
ConstructorDescriptionTargetInsn
(Dop opcode, SourcePosition position, RegisterSpecList registers, CodeAddress target) Constructs an instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected String
Gets the string form for any arguments to this instance.Gets the unique branch target of this instruction.int
Gets the target address of this instruction.int
Gets the branch offset of this instruction.boolean
Returns whether the target offset is known.withNewTargetAndReversed
(CodeAddress target) Returns an instance that is just like this one, except that its opcode has the opposite sense (as a test; e.g.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.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.Methods inherited from class com.android.dx.dex.code.FixedSizeInsn
codeSize, listingString0, withRegisterOffset, writeTo
Methods inherited from class com.android.dx.dex.code.DalvInsn
cstComment, cstString, expandedPrefix, expandedSuffix, expandedVersion, getAddress, getLowRegVersion, getMinimumRegisterRequirement, getNextAddress, getOpcode, getPosition, getRegisters, hasAddress, hasResult, identifierString, listingString, makeMove, setAddress, toString, withMapper
-
Constructor Details
-
TargetInsn
public TargetInsn(Dop opcode, SourcePosition position, RegisterSpecList registers, CodeAddress target) Constructs an instance. The output address of this instance is initially unknown (-1
), and the target is initiallynull
.- Parameters:
opcode
- the opcode; one of the constants fromDops
position
-non-null;
source positionregisters
-non-null;
register list, including a result register if appropriate (that is, registers may be either ins or outs)target
-non-null;
the branch target
-
-
Method Details
-
withOpcode
Returns an instance that is just like this one, except that its opcode is replaced by the one given, and its address is reset.- Specified by:
withOpcode
in classDalvInsn
- Parameters:
opcode
-non-null;
the new opcode- Returns:
non-null;
an appropriately-constructed instance
-
withRegisters
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.- Specified by:
withRegisters
in classDalvInsn
- Parameters:
registers
-non-null;
new register list- Returns:
non-null;
an appropriately-constructed instance
-
withNewTargetAndReversed
Returns an instance that is just like this one, except that its opcode has the opposite sense (as a test; e.g. alt
test becomes age
), and its branch target is replaced by the one given, and all set-once values associated with the class (such as its address) are reset.- Parameters:
target
-non-null;
the new branch target- Returns:
non-null;
an appropriately-constructed instance
-
getTarget
Gets the unique branch target of this instruction.- Returns:
non-null;
the branch target
-
getTargetAddress
public int getTargetAddress()Gets the target address of this instruction. This is only valid to call if the target instruction has been assigned an address, and it is merely a convenient shorthand forgetTarget().getAddress()
.- Returns:
>= 0;
the target address
-
getTargetOffset
public int getTargetOffset()Gets the branch offset of this instruction. This is only valid to call if both this and the target instruction each has been assigned an address, and it is merely a convenient shorthand forgetTargetAddress() - getAddress()
.- Returns:
- the branch offset
-
hasTargetOffset
public boolean hasTargetOffset()Returns whether the target offset is known.- Returns:
true
if the target offset is known orfalse
if not
-
argString
Gets the string form for any arguments to this instance. Subclasses must override this.
-