FileDocCategorySizeDatePackage
Dop.javaAPI DocAndroid 5.1 API4521Thu Mar 12 22:18:28 GMT 2015com.android.dexgen.dex.code

Dop

public final class Dop extends Object
Representation of an opcode.

Fields Summary
private final int
opcode
DalvOps.MIN_VALUE..DalvOps.MAX_VALUE; the opcode value itself
private final int
family
DalvOps.MIN_VALUE..DalvOps.MAX_VALUE; the opcode family
private final InsnFormat
format
{@code non-null;} the instruction format
private final boolean
hasResult
whether this opcode uses a result register
private final String
name
{@code non-null;} the name
Constructors Summary
public Dop(int opcode, int family, InsnFormat format, boolean hasResult, String name)
Constructs an instance.

param
opcode {@code DalvOps.MIN_VALUE..DalvOps.MAX_VALUE;} the opcode value itself
param
family {@code DalvOps.MIN_VALUE..DalvOps.MAX_VALUE;} the opcode family
param
format {@code non-null;} the instruction format
param
hasResult whether the opcode has a result register; if so it is always the first register
param
name {@code non-null;} the name

        if ((opcode < DalvOps.MIN_VALUE) || (opcode > DalvOps.MAX_VALUE)) {
            throw new IllegalArgumentException("bogus opcode");
        }

        if ((family < DalvOps.MIN_VALUE) || (family > DalvOps.MAX_VALUE)) {
            throw new IllegalArgumentException("bogus family");
        }

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

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

        this.opcode = opcode;
        this.family = family;
        this.format = format;
        this.hasResult = hasResult;
        this.name = name;
    
Methods Summary
public intgetFamily()
Gets the opcode family. The opcode family is the unmarked (no "/...") opcode that has equivalent semantics to this one.

return
{@code DalvOps.MIN_VALUE..DalvOps.MAX_VALUE;} the opcode family

        return family;
    
public InsnFormatgetFormat()
Gets the instruction format.

return
{@code non-null;} the instruction format

        return format;
    
public java.lang.StringgetName()
Gets the opcode name.

return
{@code non-null;} the opcode name

        return name;
    
public intgetOpcode()
Gets the opcode value.

return
{@code DalvOps.MIN_VALUE..DalvOps.MAX_VALUE;} the opcode value

        return opcode;
    
public com.android.dexgen.dex.code.DopgetOppositeTest()
Gets the opcode for the opposite test of this instance. This is only valid for opcodes which are in fact tests.

return
{@code non-null;} the opposite test

        switch (opcode) {
            case DalvOps.IF_EQ:  return Dops.IF_NE;
            case DalvOps.IF_NE:  return Dops.IF_EQ;
            case DalvOps.IF_LT:  return Dops.IF_GE;
            case DalvOps.IF_GE:  return Dops.IF_LT;
            case DalvOps.IF_GT:  return Dops.IF_LE;
            case DalvOps.IF_LE:  return Dops.IF_GT;
            case DalvOps.IF_EQZ: return Dops.IF_NEZ;
            case DalvOps.IF_NEZ: return Dops.IF_EQZ;
            case DalvOps.IF_LTZ: return Dops.IF_GEZ;
            case DalvOps.IF_GEZ: return Dops.IF_LTZ;
            case DalvOps.IF_GTZ: return Dops.IF_LEZ;
            case DalvOps.IF_LEZ: return Dops.IF_GTZ;
        }

        throw new IllegalArgumentException("bogus opcode: " + this);
    
public booleanhasResult()
Returns whether this opcode uses a result register.

return
{@code true} iff this opcode uses a result register

        return hasResult;
    
public java.lang.StringtoString()
{@inheritDoc}

        return name;