Search in sources :

Example 21 with CstLiteralBits

use of com.taobao.android.dx.rop.cst.CstLiteralBits in project atlas by alibaba.

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.taobao.android.dx.rop.cst.CstLiteralBits) RegisterSpecList(com.taobao.android.dx.rop.code.RegisterSpecList)

Example 22 with CstLiteralBits

use of com.taobao.android.dx.rop.cst.CstLiteralBits in project atlas by alibaba.

the class Form21s method isCompatible.

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

Example 23 with CstLiteralBits

use of com.taobao.android.dx.rop.cst.CstLiteralBits in project atlas by alibaba.

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.taobao.android.dx.dex.code.CstInsn) CstLiteralBits(com.taobao.android.dx.rop.cst.CstLiteralBits) Constant(com.taobao.android.dx.rop.cst.Constant) RegisterSpecList(com.taobao.android.dx.rop.code.RegisterSpecList)

Example 24 with CstLiteralBits

use of com.taobao.android.dx.rop.cst.CstLiteralBits in project atlas by alibaba.

the class Form51l 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.taobao.android.dx.rop.cst.CstLiteralBits) RegisterSpecList(com.taobao.android.dx.rop.code.RegisterSpecList)

Aggregations

CstLiteralBits (com.taobao.android.dx.rop.cst.CstLiteralBits)24 RegisterSpecList (com.taobao.android.dx.rop.code.RegisterSpecList)21 Constant (com.taobao.android.dx.rop.cst.Constant)9 CstInsn (com.taobao.android.dx.dex.code.CstInsn)6 ArrayList (java.util.ArrayList)3 RegisterSpec (com.taobao.android.dx.rop.code.RegisterSpec)2 TypeBearer (com.taobao.android.dx.rop.type.TypeBearer)2 FillArrayDataInsn (com.taobao.android.dx.rop.code.FillArrayDataInsn)1 Insn (com.taobao.android.dx.rop.code.Insn)1 PlainCstInsn (com.taobao.android.dx.rop.code.PlainCstInsn)1 PlainInsn (com.taobao.android.dx.rop.code.PlainInsn)1 ThrowingCstInsn (com.taobao.android.dx.rop.code.ThrowingCstInsn)1 ThrowingInsn (com.taobao.android.dx.rop.code.ThrowingInsn)1 CstArray (com.taobao.android.dx.rop.cst.CstArray)1 CstInteger (com.taobao.android.dx.rop.cst.CstInteger)1 CstType (com.taobao.android.dx.rop.cst.CstType)1 TypedConstant (com.taobao.android.dx.rop.cst.TypedConstant)1 HashSet (java.util.HashSet)1