Search in sources :

Example 6 with CmplExpr

use of soot.jimple.CmplExpr in project soot by Sable.

the class DavaBody method javafy_binop_expr.

private void javafy_binop_expr(ValueBox vb) {
    BinopExpr boe = (BinopExpr) vb.getValue();
    ValueBox leftOpBox = boe.getOp1Box(), rightOpBox = boe.getOp2Box();
    Value leftOp = leftOpBox.getValue(), rightOp = rightOpBox.getValue();
    if (rightOp instanceof IntConstant) {
        if ((leftOp instanceof IntConstant) == false) {
            javafy(leftOpBox);
            leftOp = leftOpBox.getValue();
            if (boe instanceof ConditionExpr)
                rightOpBox.setValue(DIntConstant.v(((IntConstant) rightOp).value, leftOp.getType()));
            else
                rightOpBox.setValue(DIntConstant.v(((IntConstant) rightOp).value, null));
        }
    } else if (leftOp instanceof IntConstant) {
        javafy(rightOpBox);
        rightOp = rightOpBox.getValue();
        if (boe instanceof ConditionExpr)
            leftOpBox.setValue(DIntConstant.v(((IntConstant) leftOp).value, rightOp.getType()));
        else
            leftOpBox.setValue(DIntConstant.v(((IntConstant) leftOp).value, null));
    } else {
        javafy(rightOpBox);
        rightOp = rightOpBox.getValue();
        javafy(leftOpBox);
        leftOp = leftOpBox.getValue();
    }
    if (boe instanceof CmpExpr)
        vb.setValue(new DCmpExpr(leftOp, rightOp));
    else if (boe instanceof CmplExpr)
        vb.setValue(new DCmplExpr(leftOp, rightOp));
    else if (boe instanceof CmpgExpr)
        vb.setValue(new DCmpgExpr(leftOp, rightOp));
}
Also used : DCmpgExpr(soot.dava.internal.javaRep.DCmpgExpr) ValueBox(soot.ValueBox) DCmpExpr(soot.dava.internal.javaRep.DCmpExpr) CmpExpr(soot.jimple.CmpExpr) ConditionExpr(soot.jimple.ConditionExpr) DCmpgExpr(soot.dava.internal.javaRep.DCmpgExpr) CmpgExpr(soot.jimple.CmpgExpr) Value(soot.Value) IntConstant(soot.jimple.IntConstant) DIntConstant(soot.dava.internal.javaRep.DIntConstant) DCmpExpr(soot.dava.internal.javaRep.DCmpExpr) DCmplExpr(soot.dava.internal.javaRep.DCmplExpr) DCmplExpr(soot.dava.internal.javaRep.DCmplExpr) CmplExpr(soot.jimple.CmplExpr) BinopExpr(soot.jimple.BinopExpr)

Aggregations

CmpExpr (soot.jimple.CmpExpr)6 CmpgExpr (soot.jimple.CmpgExpr)6 CmplExpr (soot.jimple.CmplExpr)6 NullType (soot.NullType)5 Value (soot.Value)5 AddExpr (soot.jimple.AddExpr)5 AndExpr (soot.jimple.AndExpr)5 BinopExpr (soot.jimple.BinopExpr)5 DivExpr (soot.jimple.DivExpr)5 EqExpr (soot.jimple.EqExpr)5 GeExpr (soot.jimple.GeExpr)5 GtExpr (soot.jimple.GtExpr)5 LeExpr (soot.jimple.LeExpr)5 LtExpr (soot.jimple.LtExpr)5 ArrayType (soot.ArrayType)4 Local (soot.Local)4 Type (soot.Type)4 ArrayRef (soot.jimple.ArrayRef)4 CastExpr (soot.jimple.CastExpr)4 InstanceFieldRef (soot.jimple.InstanceFieldRef)4