Search in sources :

Example 6 with Insn12x

use of soot.toDex.instructions.Insn12x 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

Insn12x (soot.toDex.instructions.Insn12x)6 Opcode (org.jf.dexlib2.Opcode)4 Value (soot.Value)3 ArrayType (soot.ArrayType)2 DoubleType (soot.DoubleType)2 FloatType (soot.FloatType)2 IntType (soot.IntType)2 IntegerType (soot.IntegerType)2 LongType (soot.LongType)2 NullType (soot.NullType)2 PrimType (soot.PrimType)2 RefType (soot.RefType)2 Type (soot.Type)2 Insn10x (soot.toDex.instructions.Insn10x)1 Insn22x (soot.toDex.instructions.Insn22x)1 Insn32x (soot.toDex.instructions.Insn32x)1