Search in sources :

Example 1 with Insn22c

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

the class ExprVisitor method caseInstanceOfExpr.

@Override
public void caseInstanceOfExpr(InstanceOfExpr ioe) {
    final Value referenceToCheck = ioe.getOp();
    // There are some strange apps that use constants here
    constantV.setOrigStmt(origStmt);
    Register referenceToCheckReg = regAlloc.asImmediate(referenceToCheck, constantV);
    TypeReference checkType = DexPrinter.toTypeReference(ioe.getCheckType());
    stmtV.addInsn(new Insn22c(Opcode.INSTANCE_OF, destinationReg, referenceToCheckReg, checkType), origStmt);
}
Also used : Insn22c(soot.toDex.instructions.Insn22c) Value(soot.Value) TypeReference(org.jf.dexlib2.iface.reference.TypeReference)

Example 2 with Insn22c

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

the class ExprVisitor method caseNewArrayExpr.

@Override
public void caseNewArrayExpr(NewArrayExpr nae) {
    Value size = nae.getSize();
    constantV.setOrigStmt(origStmt);
    Register sizeReg = regAlloc.asImmediate(size, constantV);
    ArrayType arrayType = nae.getBaseType().getArrayType();
    TypeReference arrayTypeItem = DexPrinter.toTypeReference(arrayType);
    stmtV.addInsn(new Insn22c(Opcode.NEW_ARRAY, destinationReg, sizeReg, arrayTypeItem), origStmt);
}
Also used : ArrayType(soot.ArrayType) Insn22c(soot.toDex.instructions.Insn22c) Value(soot.Value) TypeReference(org.jf.dexlib2.iface.reference.TypeReference)

Example 3 with Insn22c

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

the class StmtVisitor method buildInstanceFieldPutInsn.

private Insn buildInstanceFieldPutInsn(InstanceFieldRef destRef, Value source) {
    FieldReference destField = DexPrinter.toFieldReference(destRef.getFieldRef());
    Local instance = (Local) destRef.getBase();
    Register instanceReg = regAlloc.asLocal(instance);
    Register sourceReg = regAlloc.asImmediate(source, constantV);
    Opcode opc = getPutGetOpcodeWithTypeSuffix(IPUT_OPCODE, destField.getType());
    return new Insn22c(opc, sourceReg, instanceReg, destField);
}
Also used : Insn22c(soot.toDex.instructions.Insn22c) FieldReference(org.jf.dexlib2.iface.reference.FieldReference) Local(soot.Local) Opcode(org.jf.dexlib2.Opcode)

Example 4 with Insn22c

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

the class StmtVisitor method buildInstanceFieldGetInsn.

private Insn buildInstanceFieldGetInsn(Register destinationReg, InstanceFieldRef sourceRef) {
    Local instance = (Local) sourceRef.getBase();
    Register instanceReg = regAlloc.asLocal(instance);
    FieldReference sourceField = DexPrinter.toFieldReference(sourceRef.getFieldRef());
    Opcode opc = getPutGetOpcodeWithTypeSuffix(IGET_OPCODE, sourceField.getType());
    return new Insn22c(opc, destinationReg, instanceReg, sourceField);
}
Also used : Insn22c(soot.toDex.instructions.Insn22c) FieldReference(org.jf.dexlib2.iface.reference.FieldReference) Local(soot.Local) Opcode(org.jf.dexlib2.Opcode)

Aggregations

Insn22c (soot.toDex.instructions.Insn22c)4 Opcode (org.jf.dexlib2.Opcode)2 FieldReference (org.jf.dexlib2.iface.reference.FieldReference)2 TypeReference (org.jf.dexlib2.iface.reference.TypeReference)2 Local (soot.Local)2 Value (soot.Value)2 ArrayType (soot.ArrayType)1