use of soot.jimple.internal.JAssignStmt in project soot by Sable.
the class MoveResultInstruction method jimplify.
@Override
public void jimplify(DexBody body) {
// if (local != null && expr != null)
// throw new RuntimeException("Both local and expr are set to move.");
int dest = ((OneRegisterInstruction) instruction).getRegisterA();
// if (local != null)
// assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), local);
// else if (expr != null)
// assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), expr);
// else
// throw new RuntimeException("Neither local and expr are set to move.");
AssignStmt assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), body.getStoreResultLocal());
setUnit(assign);
addTags(assign);
body.add(assign);
if (IDalvikTyper.ENABLE_DVKTYPER) {
JAssignStmt jassign = (JAssignStmt) assign;
DalvikTyper.v().addConstraint(assign.getLeftOpBox(), assign.getRightOpBox());
}
}
use of soot.jimple.internal.JAssignStmt in project soot by Sable.
the class CmpInstruction method jimplify.
@Override
public void jimplify(DexBody body) {
if (!(instruction instanceof Instruction23x))
throw new IllegalArgumentException("Expected Instruction23x but got: " + instruction.getClass());
Instruction23x cmpInstr = (Instruction23x) instruction;
int dest = cmpInstr.getRegisterA();
Local first = body.getRegisterLocal(cmpInstr.getRegisterB());
Local second = body.getRegisterLocal(cmpInstr.getRegisterC());
// Expr cmpExpr;
// Type type = null
Opcode opcode = instruction.getOpcode();
Expr cmpExpr = null;
Type type = null;
switch(opcode) {
case CMPL_DOUBLE:
setTag(new DoubleOpTag());
type = DoubleType.v();
cmpExpr = Jimple.v().newCmplExpr(first, second);
break;
case CMPL_FLOAT:
setTag(new FloatOpTag());
type = FloatType.v();
cmpExpr = Jimple.v().newCmplExpr(first, second);
break;
case CMPG_DOUBLE:
setTag(new DoubleOpTag());
type = DoubleType.v();
cmpExpr = Jimple.v().newCmpgExpr(first, second);
break;
case CMPG_FLOAT:
setTag(new FloatOpTag());
type = FloatType.v();
cmpExpr = Jimple.v().newCmpgExpr(first, second);
break;
case CMP_LONG:
setTag(new LongOpTag());
type = LongType.v();
cmpExpr = Jimple.v().newCmpExpr(first, second);
break;
default:
throw new RuntimeException("no opcode for CMP: " + opcode);
}
AssignStmt assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), cmpExpr);
assign.addTag(getTag());
setUnit(assign);
addTags(assign);
body.add(assign);
if (IDalvikTyper.ENABLE_DVKTYPER) {
getTag().getName();
BinopExpr bexpr = (BinopExpr) cmpExpr;
DalvikTyper.v().setType(bexpr.getOp1Box(), type, true);
DalvikTyper.v().setType(bexpr.getOp2Box(), type, true);
DalvikTyper.v().setType(((JAssignStmt) assign).leftBox, IntType.v(), false);
}
}
Aggregations