FileDocCategorySizeDatePackage
PlainInsn.javaAPI DocAndroid 1.5 API4246Wed May 06 22:41:02 BST 2009com.android.dx.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 non-null; the opcode
param
position non-null; source position
param
result null-ok; spec for the result, if any
param
sources 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 non-null; the opcode
param
position non-null; source position
param
result null-ok; spec for the result, if any
param
source 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.dx.rop.type.TypeListgetCatches()
{@inheritDoc}

        return StdTypeList.EMPTY;
    
public InsnwithAddedCatch(com.android.dx.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));