Search in sources :

Example 31 with CstLiteralBits

use of com.android.dx.rop.cst.CstLiteralBits in project buck by facebook.

the class Form21s method insnArgString.

/** {@inheritDoc} */
@Override
public String insnArgString(DalvInsn insn) {
    RegisterSpecList regs = insn.getRegisters();
    CstLiteralBits value = (CstLiteralBits) ((CstInsn) insn).getConstant();
    return regs.get(0).regString() + ", " + literalBitsString(value);
}
Also used : CstLiteralBits(com.android.dx.rop.cst.CstLiteralBits) RegisterSpecList(com.android.dx.rop.code.RegisterSpecList)

Example 32 with CstLiteralBits

use of com.android.dx.rop.cst.CstLiteralBits in project buck by facebook.

the class Form21s method writeTo.

/** {@inheritDoc} */
@Override
public void writeTo(AnnotatedOutput out, DalvInsn insn) {
    RegisterSpecList regs = insn.getRegisters();
    int value = ((CstLiteralBits) ((CstInsn) insn).getConstant()).getIntBits();
    write(out, opcodeUnit(insn, regs.get(0).getReg()), (short) value);
}
Also used : CstLiteralBits(com.android.dx.rop.cst.CstLiteralBits) RegisterSpecList(com.android.dx.rop.code.RegisterSpecList)

Example 33 with CstLiteralBits

use of com.android.dx.rop.cst.CstLiteralBits in project buck by facebook.

the class Form22b method writeTo.

/** {@inheritDoc} */
@Override
public void writeTo(AnnotatedOutput out, DalvInsn insn) {
    RegisterSpecList regs = insn.getRegisters();
    int value = ((CstLiteralBits) ((CstInsn) insn).getConstant()).getIntBits();
    write(out, opcodeUnit(insn, regs.get(0).getReg()), codeUnit(regs.get(1).getReg(), value & 0xff));
}
Also used : CstLiteralBits(com.android.dx.rop.cst.CstLiteralBits) RegisterSpecList(com.android.dx.rop.code.RegisterSpecList)

Example 34 with CstLiteralBits

use of com.android.dx.rop.cst.CstLiteralBits in project buck by facebook.

the class Form22b method isCompatible.

/** {@inheritDoc} */
@Override
public boolean isCompatible(DalvInsn insn) {
    RegisterSpecList regs = insn.getRegisters();
    if (!((insn instanceof CstInsn) && (regs.size() == 2) && unsignedFitsInByte(regs.get(0).getReg()) && unsignedFitsInByte(regs.get(1).getReg()))) {
        return false;
    }
    CstInsn ci = (CstInsn) insn;
    Constant cst = ci.getConstant();
    if (!(cst instanceof CstLiteralBits)) {
        return false;
    }
    CstLiteralBits cb = (CstLiteralBits) cst;
    return cb.fitsInInt() && signedFitsInByte(cb.getIntBits());
}
Also used : CstInsn(com.android.dx.dex.code.CstInsn) CstLiteralBits(com.android.dx.rop.cst.CstLiteralBits) Constant(com.android.dx.rop.cst.Constant) RegisterSpecList(com.android.dx.rop.code.RegisterSpecList)

Example 35 with CstLiteralBits

use of com.android.dx.rop.cst.CstLiteralBits in project buck by facebook.

the class Form22b method insnArgString.

/** {@inheritDoc} */
@Override
public String insnArgString(DalvInsn insn) {
    RegisterSpecList regs = insn.getRegisters();
    CstLiteralBits value = (CstLiteralBits) ((CstInsn) insn).getConstant();
    return regs.get(0).regString() + ", " + regs.get(1).regString() + ", " + literalBitsString(value);
}
Also used : CstLiteralBits(com.android.dx.rop.cst.CstLiteralBits) RegisterSpecList(com.android.dx.rop.code.RegisterSpecList)

Aggregations

CstLiteralBits (com.android.dx.rop.cst.CstLiteralBits)48 RegisterSpecList (com.android.dx.rop.code.RegisterSpecList)42 Constant (com.android.dx.rop.cst.Constant)18 CstInsn (com.android.dx.dex.code.CstInsn)12 ArrayList (java.util.ArrayList)6 RegisterSpec (com.android.dx.rop.code.RegisterSpec)4 TypeBearer (com.android.dx.rop.type.TypeBearer)4 FillArrayDataInsn (com.android.dx.rop.code.FillArrayDataInsn)2 Insn (com.android.dx.rop.code.Insn)2 PlainCstInsn (com.android.dx.rop.code.PlainCstInsn)2 PlainInsn (com.android.dx.rop.code.PlainInsn)2 ThrowingCstInsn (com.android.dx.rop.code.ThrowingCstInsn)2 ThrowingInsn (com.android.dx.rop.code.ThrowingInsn)2 CstArray (com.android.dx.rop.cst.CstArray)2 CstInteger (com.android.dx.rop.cst.CstInteger)2 CstType (com.android.dx.rop.cst.CstType)2 TypedConstant (com.android.dx.rop.cst.TypedConstant)2 HashSet (java.util.HashSet)2