Search in sources :

Example 1 with GtExpr

use of soot.jimple.GtExpr in project robovm by robovm.

the class MethodCompiler method if_.

private void if_(IfStmt stmt) {
    ConditionExpr condition = (ConditionExpr) stmt.getCondition();
    Value op1 = immediate(stmt, (Immediate) condition.getOp1());
    Value op2 = immediate(stmt, (Immediate) condition.getOp2());
    Icmp.Condition c = null;
    if (condition instanceof EqExpr) {
        c = Icmp.Condition.eq;
    } else if (condition instanceof NeExpr) {
        c = Icmp.Condition.ne;
    } else if (condition instanceof GtExpr) {
        c = Icmp.Condition.sgt;
    } else if (condition instanceof LtExpr) {
        c = Icmp.Condition.slt;
    } else if (condition instanceof GeExpr) {
        c = Icmp.Condition.sge;
    } else if (condition instanceof LeExpr) {
        c = Icmp.Condition.sle;
    }
    Variable result = function.newVariable(Type.I1);
    function.add(new Icmp(result, c, op1, op2)).attach(stmt);
    Unit nextUnit = sootMethod.getActiveBody().getUnits().getSuccOf(stmt);
    function.add(new Br(new VariableRef(result), function.newBasicBlockRef(new Label(stmt.getTarget())), function.newBasicBlockRef(new Label(nextUnit)))).attach(stmt);
}
Also used : VariableRef(org.robovm.compiler.llvm.VariableRef) Condition(org.robovm.compiler.llvm.Icmp.Condition) Variable(org.robovm.compiler.llvm.Variable) NeExpr(soot.jimple.NeExpr) Label(org.robovm.compiler.llvm.Label) GtExpr(soot.jimple.GtExpr) LtExpr(soot.jimple.LtExpr) GeExpr(soot.jimple.GeExpr) Unit(soot.Unit) LeExpr(soot.jimple.LeExpr) Br(org.robovm.compiler.llvm.Br) EqExpr(soot.jimple.EqExpr) ConditionExpr(soot.jimple.ConditionExpr) Value(org.robovm.compiler.llvm.Value) Icmp(org.robovm.compiler.llvm.Icmp)

Aggregations

Br (org.robovm.compiler.llvm.Br)1 Icmp (org.robovm.compiler.llvm.Icmp)1 Condition (org.robovm.compiler.llvm.Icmp.Condition)1 Label (org.robovm.compiler.llvm.Label)1 Value (org.robovm.compiler.llvm.Value)1 Variable (org.robovm.compiler.llvm.Variable)1 VariableRef (org.robovm.compiler.llvm.VariableRef)1 Unit (soot.Unit)1 ConditionExpr (soot.jimple.ConditionExpr)1 EqExpr (soot.jimple.EqExpr)1 GeExpr (soot.jimple.GeExpr)1 GtExpr (soot.jimple.GtExpr)1 LeExpr (soot.jimple.LeExpr)1 LtExpr (soot.jimple.LtExpr)1 NeExpr (soot.jimple.NeExpr)1