FileDocCategorySizeDatePackage
TargetInsn.javaAPI DocAndroid 5.1 API4274Thu Mar 12 22:18:30 GMT 2015com.android.dx.dex.code

TargetInsn

public final class TargetInsn extends FixedSizeInsn
Instruction which has a single branch target.

Fields Summary
private CodeAddress
target
{@code non-null;} the branch target
Constructors Summary
public TargetInsn(Dop opcode, com.android.dx.rop.code.SourcePosition position, com.android.dx.rop.code.RegisterSpecList registers, CodeAddress target)
Constructs an instance. The output address of this instance is initially unknown ({@code -1}), and the target is initially {@code null}.

param
opcode the opcode; one of the constants from {@link Dops}
param
position {@code non-null;} source position
param
registers {@code non-null;} register list, including a result register if appropriate (that is, registers may be either ins or outs)
param
target {@code non-null;} the branch target

        super(opcode, position, registers);

        if (target == null) {
            throw new NullPointerException("target == null");
        }

        this.target = target;
    
Methods Summary
protected java.lang.StringargString()
{@inheritDoc}

        if (target == null) {
            return "????";
        }

        return target.identifierString();
    
public CodeAddressgetTarget()
Gets the unique branch target of this instruction.

return
{@code non-null;} the branch target

        return target;
    
public intgetTargetAddress()
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 {@code getTarget().getAddress()}.

return
{@code >= 0;} the target address

        return target.getAddress();
    
public intgetTargetOffset()
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 {@code getTargetAddress() - getAddress()}.

return
the branch offset

        return target.getAddress() - getAddress();
    
public booleanhasTargetOffset()
Returns whether the target offset is known.

return
{@code true} if the target offset is known or {@code false} if not

        return hasAddress() && target.hasAddress();
    
public com.android.dx.dex.code.TargetInsnwithNewTargetAndReversed(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 {@code lt} test becomes a {@code 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.

param
target {@code non-null;} the new branch target
return
{@code non-null;} an appropriately-constructed instance

        Dop opcode = getOpcode().getOppositeTest();

        return new TargetInsn(opcode, getPosition(), getRegisters(), target);
    
public DalvInsnwithOpcode(Dop opcode)
{@inheritDoc}

        return new TargetInsn(opcode, getPosition(), getRegisters(), target);
    
public DalvInsnwithRegisters(com.android.dx.rop.code.RegisterSpecList registers)
{@inheritDoc}

        return new TargetInsn(getOpcode(), getPosition(), registers, target);