Search in sources :

Example 61 with RegisterSpecList

use of com.taobao.android.dx.rop.code.RegisterSpecList in project atlas by alibaba.

the class HighRegisterPrefix method calculateInsnsIfNecessary.

/**
     * Helper for {@link #codeSize} and {@link #writeTo} which sets up
     * {@link #insns} if not already done.
     */
private void calculateInsnsIfNecessary() {
    if (insns != null) {
        return;
    }
    RegisterSpecList registers = getRegisters();
    int sz = registers.size();
    insns = new SimpleInsn[sz];
    for (int i = 0, outAt = 0; i < sz; i++) {
        RegisterSpec src = registers.get(i);
        insns[i] = moveInsnFor(src, outAt);
        outAt += src.getCategory();
    }
}
Also used : RegisterSpecList(com.taobao.android.dx.rop.code.RegisterSpecList) RegisterSpec(com.taobao.android.dx.rop.code.RegisterSpec)

Example 62 with RegisterSpecList

use of com.taobao.android.dx.rop.code.RegisterSpecList in project atlas by alibaba.

the class HighRegisterPrefix method listingString0.

/** {@inheritDoc} */
@Override
protected String listingString0(boolean noteIndices) {
    RegisterSpecList registers = getRegisters();
    int sz = registers.size();
    StringBuffer sb = new StringBuffer(100);
    for (int i = 0, outAt = 0; i < sz; i++) {
        RegisterSpec src = registers.get(i);
        SimpleInsn insn = moveInsnFor(src, outAt);
        if (i != 0) {
            sb.append('\n');
        }
        sb.append(insn.listingString0(noteIndices));
        outAt += src.getCategory();
    }
    return sb.toString();
}
Also used : RegisterSpecList(com.taobao.android.dx.rop.code.RegisterSpecList) RegisterSpec(com.taobao.android.dx.rop.code.RegisterSpec)

Example 63 with RegisterSpecList

use of com.taobao.android.dx.rop.code.RegisterSpecList in project atlas by alibaba.

the class Form21h 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)

Example 64 with RegisterSpecList

use of com.taobao.android.dx.rop.code.RegisterSpecList in project atlas by alibaba.

the class Form21h method writeTo.

/** {@inheritDoc} */
@Override
public void writeTo(AnnotatedOutput out, DalvInsn insn) {
    RegisterSpecList regs = insn.getRegisters();
    CstLiteralBits cb = (CstLiteralBits) ((CstInsn) insn).getConstant();
    short bits;
    // Where the high bits are depends on the category of the target.
    if (regs.get(0).getCategory() == 1) {
        bits = (short) (cb.getIntBits() >>> 16);
    } else {
        bits = (short) (cb.getLongBits() >>> 48);
    }
    write(out, opcodeUnit(insn, regs.get(0).getReg()), bits);
}
Also used : CstLiteralBits(com.taobao.android.dx.rop.cst.CstLiteralBits) RegisterSpecList(com.taobao.android.dx.rop.code.RegisterSpecList)

Example 65 with RegisterSpecList

use of com.taobao.android.dx.rop.code.RegisterSpecList 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)

Aggregations

RegisterSpecList (com.taobao.android.dx.rop.code.RegisterSpecList)98 RegisterSpec (com.taobao.android.dx.rop.code.RegisterSpec)24 BitSet (java.util.BitSet)22 CstLiteralBits (com.taobao.android.dx.rop.cst.CstLiteralBits)21 CstInsn (com.taobao.android.dx.dex.code.CstInsn)17 Constant (com.taobao.android.dx.rop.cst.Constant)17 PlainInsn (com.taobao.android.dx.rop.code.PlainInsn)9 CstType (com.taobao.android.dx.rop.cst.CstType)6 TargetInsn (com.taobao.android.dx.dex.code.TargetInsn)5 Insn (com.taobao.android.dx.rop.code.Insn)5 TypedConstant (com.taobao.android.dx.rop.cst.TypedConstant)5 PlainCstInsn (com.taobao.android.dx.rop.code.PlainCstInsn)4 Rop (com.taobao.android.dx.rop.code.Rop)4 CstFieldRef (com.taobao.android.dx.rop.cst.CstFieldRef)4 ThrowingCstInsn (com.taobao.android.dx.rop.code.ThrowingCstInsn)3 ThrowingInsn (com.taobao.android.dx.rop.code.ThrowingInsn)3 CstInteger (com.taobao.android.dx.rop.cst.CstInteger)3 CstMethodRef (com.taobao.android.dx.rop.cst.CstMethodRef)3 TypeBearer (com.taobao.android.dx.rop.type.TypeBearer)3 FillArrayDataInsn (com.taobao.android.dx.rop.code.FillArrayDataInsn)2