Search in sources :

Example 76 with Expr

use of org.mapleir.ir.code.Expr in project maple-ir by LLVM-but-worse.

the class GenerationPass method _jump_cmp0.

protected void _jump_cmp0(BasicBlock target, ComparisonType type) {
    save_stack(false);
    Expr left = pop();
    ConstantExpr right = new ConstantExpr((byte) 0, Type.BYTE_TYPE, false);
    _jump_cmp(target, type, left, right);
}
Also used : InvocationExpr(org.mapleir.ir.code.expr.invoke.InvocationExpr) Expr(org.mapleir.ir.code.Expr)

Example 77 with Expr

use of org.mapleir.ir.code.Expr in project maple-ir by LLVM-but-worse.

the class GenerationPass method _store.

protected void _store(int index, Type type) {
    save_stack(false);
    Expr expr = pop();
    VarExpr var = _var_expr(index, expr.getType(), false);
    addStmt(copy(var, expr));
}
Also used : InvocationExpr(org.mapleir.ir.code.expr.invoke.InvocationExpr) Expr(org.mapleir.ir.code.Expr)

Example 78 with Expr

use of org.mapleir.ir.code.Expr in project maple-ir by LLVM-but-worse.

the class GenerationPass method _dup_x1.

protected void _dup_x1() {
    // prestack: var1, var0 (height = 2)
    // poststack: var2, var1, var0
    // assignments: var0 = var1(initial)
    // assignments: var1 = var0(initial)
    // assignments: var2 = var1(initial)
    currentStack.assertHeights(DUP_X1_HEIGHTS);
    int baseHeight = currentStack.height();
    save_stack(false);
    Expr var1 = pop();
    Expr var0 = pop();
    // var3 = var0
    Type var3Type = assign_stack(baseHeight + 1, var0);
    // var0 = var1(initial)
    Type var0Type = assign_stack(baseHeight - 2, var1);
    // var2 = var1(initial)
    Type var2Type = assign_stack(baseHeight + 0, var1.copy());
    // var1 = var3 = var0(initial)
    Type var1Type = assign_stack(baseHeight - 1, load_stack(baseHeight + 1, var3Type));
    // push var0
    push(load_stack(baseHeight - 2, var0Type));
    // push var1
    push(load_stack(baseHeight - 1, var1Type));
    // push var2
    push(load_stack(baseHeight + 0, var2Type));
}
Also used : Type(org.objectweb.asm.Type) ComparisonType(org.mapleir.ir.code.stmt.ConditionalJumpStmt.ComparisonType) ValueComparisonType(org.mapleir.ir.code.expr.ComparisonExpr.ValueComparisonType) ArrayType(org.mapleir.ir.TypeUtils.ArrayType) InvocationExpr(org.mapleir.ir.code.expr.invoke.InvocationExpr) Expr(org.mapleir.ir.code.Expr)

Example 79 with Expr

use of org.mapleir.ir.code.Expr in project maple-ir by LLVM-but-worse.

the class GenerationPass method _load_array.

protected void _load_array(ArrayType type) {
    save_stack(false);
    // prestack: var1, var0 (height = 2)
    // poststack: var0
    // assignments: var0 = var0[var1]
    // int height = currentStack.height();
    Expr index = pop();
    Expr array = pop();
    push(new ArrayLoadExpr(array, index, type));
// assign_stack(height - 2, new ArrayLoadExpr(array, index, type));
// push(load_stack(height - 2, type.getType()));
}
Also used : InvocationExpr(org.mapleir.ir.code.expr.invoke.InvocationExpr) Expr(org.mapleir.ir.code.Expr)

Example 80 with Expr

use of org.mapleir.ir.code.Expr in project maple-ir by LLVM-but-worse.

the class GenerationPass method _pop.

protected void _pop(int amt) {
    for (int i = 0; i < amt; ) {
        Expr top = pop();
        addStmt(new PopStmt(top));
        i += top.getType().getSize();
    }
}
Also used : InvocationExpr(org.mapleir.ir.code.expr.invoke.InvocationExpr) Expr(org.mapleir.ir.code.Expr)

Aggregations

Expr (org.mapleir.ir.code.Expr)87 VarExpr (org.mapleir.ir.code.expr.VarExpr)46 InvocationExpr (org.mapleir.ir.code.expr.invoke.InvocationExpr)45 BasicBlock (org.mapleir.ir.cfg.BasicBlock)32 PhiExpr (org.mapleir.ir.code.expr.PhiExpr)31 Stmt (org.mapleir.ir.code.Stmt)29 ConstantExpr (org.mapleir.ir.code.expr.ConstantExpr)26 AbstractCopyStmt (org.mapleir.ir.code.stmt.copy.AbstractCopyStmt)26 Local (org.mapleir.ir.locals.Local)22 Type (org.objectweb.asm.Type)21 VersionedLocal (org.mapleir.ir.locals.impl.VersionedLocal)20 CopyPhiStmt (org.mapleir.ir.code.stmt.copy.CopyPhiStmt)19 InitialisedObjectExpr (org.mapleir.ir.code.expr.invoke.InitialisedObjectExpr)17 ComparisonType (org.mapleir.ir.code.stmt.ConditionalJumpStmt.ComparisonType)14 CopyVarStmt (org.mapleir.ir.code.stmt.copy.CopyVarStmt)14 ValueComparisonType (org.mapleir.ir.code.expr.ComparisonExpr.ValueComparisonType)13 ArrayType (org.mapleir.ir.TypeUtils.ArrayType)12 HashSet (java.util.HashSet)11 ArithmeticExpr (org.mapleir.ir.code.expr.ArithmeticExpr)11 ControlFlowGraph (org.mapleir.ir.cfg.ControlFlowGraph)9