Top Description Fields Constructors Methods
org.droidparts.dexmaker.dx.dex.code

public final Class TargetInsn

extends FixedSizeInsn
Class Inheritance
Imports
org.droidparts.dexmaker.dx.rop.code.RegisterSpecList, .SourcePosition

Instruction which has a single branch target.

Field Summary

Modifier and TypeField and Description
private CodeAddress
target

non-null; the branch target

Constructor Summary

AccessConstructor and Description
public
TargetInsn(Dop
the opcode; one of the constants from Dops
opcode
,
SourcePosition
non-null; source position
position
,
RegisterSpecList
non-null; register list, including a result register if appropriate (that is, registers may be either ins or outs)
registers
,
CodeAddress
non-null; the branch target
target
)

Constructs an instance.

Method Summary

Modifier and TypeMethod and Description
protected String
argString()

Implements abstract org.droidparts.dexmaker.dx.dex.code.DalvInsn.argString.

Gets the string form for any arguments to this instance.
public CodeAddress

Returns:

non-null; the branch target
getTarget
()

Gets the unique branch target of this instruction.

public int

Returns:

>= 0; the target address
getTargetAddress
()

Gets the target address of this instruction.

public int

Returns:

the branch offset
getTargetOffset
()

Gets the branch offset of this instruction.

public boolean

Returns:

true if the target offset is known or false if not
hasTargetOffset
()

Returns whether the target offset is known.

public TargetInsn

Returns:

non-null; an appropriately-constructed instance
withNewTargetAndReversed
(CodeAddress
non-null; the new branch target
target
)

Returns an instance that is just like this one, except that its opcode has the opposite sense (as a test; e.g. a lt test becomes a ge), 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.

public DalvInsn
withOpcode(Dop
non-null; the new opcode
opcode
)

Implements abstract org.droidparts.dexmaker.dx.dex.code.DalvInsn.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.
public DalvInsn
withRegisters(RegisterSpecList
non-null; new register list
registers
)

Implements abstract org.droidparts.dexmaker.dx.dex.code.DalvInsn.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.
Inherited from org.droidparts.dexmaker.dx.dex.code.FixedSizeInsn:
codeSizelistingString0withRegisterOffsetwriteTo

Field Detail

targetback to summary
private CodeAddress target

non-null; the branch target

Constructor Detail

TargetInsnback to summary
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 initially null.

Parameters
opcode:Dop

the opcode; one of the constants from Dops

position:SourcePosition

non-null; source position

registers:RegisterSpecList

non-null; register list, including a result register if appropriate (that is, registers may be either ins or outs)

target:CodeAddress

non-null; the branch target

Method Detail

argStringback to summary
protected String argString()

Implements abstract org.droidparts.dexmaker.dx.dex.code.DalvInsn.argString.

Doc from org.droidparts.dexmaker.dx.dex.code.DalvInsn.argString.

Gets the string form for any arguments to this instance. Subclasses must override this.

Returns:String

null-ok; the string version of any arguments or null if there are none

Annotations
@Override
getTargetback to summary
public CodeAddress getTarget()

Gets the unique branch target of this instruction.

Returns:CodeAddress

non-null; the branch target

getTargetAddressback to summary
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 for getTarget().getAddress().

Returns:int

>= 0; the target address

getTargetOffsetback to summary
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 for getTargetAddress() - getAddress().

Returns:int

the branch offset

hasTargetOffsetback to summary
public boolean hasTargetOffset()

Returns whether the target offset is known.

Returns:boolean

true if the target offset is known or false if not

withNewTargetAndReversedback to summary
public TargetInsn 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. a lt test becomes a ge), 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:CodeAddress

non-null; the new branch target

Returns:TargetInsn

non-null; an appropriately-constructed instance

withOpcodeback to summary
public DalvInsn withOpcode(Dop opcode)

Implements abstract org.droidparts.dexmaker.dx.dex.code.DalvInsn.withOpcode.

Doc from org.droidparts.dexmaker.dx.dex.code.DalvInsn.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.

Parameters
opcode:Dop

non-null; the new opcode

Returns:DalvInsn

non-null; an appropriately-constructed instance

Annotations
@Override
withRegistersback to summary
public DalvInsn withRegisters(RegisterSpecList registers)

Implements abstract org.droidparts.dexmaker.dx.dex.code.DalvInsn.withRegisters.

Doc from org.droidparts.dexmaker.dx.dex.code.DalvInsn.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.

Parameters
registers:RegisterSpecList

non-null; new register list

Returns:DalvInsn

non-null; an appropriately-constructed instance

Annotations
@Override