Search in sources :

Example 1 with Insn32x

use of soot.toDex.instructions.Insn32x in project soot by Sable.

the class StmtVisitor method buildMoveInsn.

protected static Insn buildMoveInsn(Register destinationReg, Register sourceReg) {
    // get the optional opcode suffix, depending on the sizes of the regs
    if (!destinationReg.fitsShort()) {
        Opcode opc;
        if (sourceReg.isObject())
            opc = Opcode.MOVE_OBJECT_16;
        else if (sourceReg.isWide())
            opc = Opcode.MOVE_WIDE_16;
        else
            opc = Opcode.MOVE_16;
        return new Insn32x(opc, destinationReg, sourceReg);
    } else if (!destinationReg.fitsByte() || !sourceReg.fitsByte()) {
        Opcode opc;
        if (sourceReg.isObject())
            opc = Opcode.MOVE_OBJECT_FROM16;
        else if (sourceReg.isWide())
            opc = Opcode.MOVE_WIDE_FROM16;
        else
            opc = Opcode.MOVE_FROM16;
        return new Insn22x(opc, destinationReg, sourceReg);
    }
    Opcode opc;
    if (sourceReg.isObject())
        opc = Opcode.MOVE_OBJECT;
    else if (sourceReg.isWide())
        opc = Opcode.MOVE_WIDE;
    else
        opc = Opcode.MOVE;
    return new Insn12x(opc, destinationReg, sourceReg);
}
Also used : Insn12x(soot.toDex.instructions.Insn12x) Opcode(org.jf.dexlib2.Opcode) Insn32x(soot.toDex.instructions.Insn32x) Insn22x(soot.toDex.instructions.Insn22x)

Aggregations

Opcode (org.jf.dexlib2.Opcode)1 Insn12x (soot.toDex.instructions.Insn12x)1 Insn22x (soot.toDex.instructions.Insn22x)1 Insn32x (soot.toDex.instructions.Insn32x)1