FileDocCategorySizeDatePackage
PlainInsn.javaAPI DocAndroid 5.1 API4320Thu Mar 12 22:18:30 GMT 2015com.android.dexgen.rop.code

PlainInsn

public final class PlainInsn extends Insn
Plain instruction, which has no embedded data and which cannot possibly throw an exception.

Fields Summary
Constructors Summary
public PlainInsn(Rop opcode, SourcePosition position, RegisterSpec result, RegisterSpecList sources)
Constructs an instance.

param
opcode {@code non-null;} the opcode
param
position {@code non-null;} source position
param
result {@code null-ok;} spec for the result, if any
param
sources {@code non-null;} specs for all the sources

        super(opcode, position, result, sources);

        switch (opcode.getBranchingness()) {
            case Rop.BRANCH_SWITCH:
            case Rop.BRANCH_THROW: {
                throw new IllegalArgumentException("bogus branchingness");
            }
        }

        if (result != null && opcode.getBranchingness() != Rop.BRANCH_NONE) {
            // move-result-pseudo is required here
            throw new IllegalArgumentException
                    ("can't mix branchingness with result");
        }
    
public PlainInsn(Rop opcode, SourcePosition position, RegisterSpec result, RegisterSpec source)
Constructs a single-source instance.

param
opcode {@code non-null;} the opcode
param
position {@code non-null;} source position
param
result {@code null-ok;} spec for the result, if any
param
source {@code non-null;} spec for the source

        this(opcode, position, result, RegisterSpecList.make(source));
    
Methods Summary
public voidaccept(Visitor visitor)
{@inheritDoc}

        visitor.visitPlainInsn(this);
    
public com.android.dexgen.rop.type.TypeListgetCatches()
{@inheritDoc}

        return StdTypeList.EMPTY;
    
public InsnwithAddedCatch(com.android.dexgen.rop.type.Type type)
{@inheritDoc}

        throw new UnsupportedOperationException("unsupported");
    
public InsnwithLastSourceLiteral()
{@inheritDoc}

        RegisterSpecList sources = getSources();
        int szSources = sources.size();

        if (szSources == 0) {
            return this;
        }

        TypeBearer lastType = sources.get(szSources - 1).getTypeBearer();

        if (!lastType.isConstant()) {
            return this;
        }

        Constant cst = (Constant) lastType;

        RegisterSpecList newSources = sources.withoutLast();

        Rop newRop;
        try {
            newRop = Rops.ropFor(getOpcode().getOpcode(),
                    getResult(), newSources, (Constant)lastType);
        } catch (IllegalArgumentException ex) {
            // There's no rop for this case
            return this;
        }

        return new PlainCstInsn(newRop, getPosition(),
                getResult(), newSources, cst);
    
public InsnwithNewRegisters(RegisterSpec result, RegisterSpecList sources)
{@inheritDoc}


        return new PlainInsn(getOpcode(), getPosition(),
                             result,
                             sources);

    
public InsnwithRegisterOffset(int delta)
{@inheritDoc}

        return new PlainInsn(getOpcode(), getPosition(),
                             getResult().withOffset(delta),
                             getSources().withOffset(delta));