cleanup vrp
[libfirm] / ir / lower / lower_intrinsics.c
index 4c52ccf..ce28ba4 100644 (file)
@@ -44,6 +44,7 @@
 #include "error.h"
 #include "be.h"
 #include "util.h"
+#include "firmstat_t.h"
 
 /** Walker environment. */
 typedef struct walker_env {
@@ -259,7 +260,8 @@ int i_mapper_bswap(ir_node *call, void *ctx)
        ir_node *irn;
        (void) ctx;
 
-       irn = new_rd_Builtin(dbg, block, get_irg_no_mem(current_ir_graph), 1, &op, ir_bk_bswap, tp);
+       ir_graph *const irg = get_Block_irg(block);
+       irn = new_rd_Builtin(dbg, block, get_irg_no_mem(irg), 1, &op, ir_bk_bswap, tp);
        set_irn_pinned(irn, op_pin_state_floats);
        irn = new_r_Proj(irn, get_irn_mode(op), pn_Builtin_max+1);
        replace_call(irn, call, mem, NULL, NULL);
@@ -872,11 +874,11 @@ int i_mapper_strcmp(ir_node *call, void *ctx)
                return 0;
        char_tp = get_pointer_points_to_type(char_tp);
 
+       ir_node *mem = get_Call_mem(call);
        if (left == right) {
                /* a strcmp(s, s) ==> 0 */
-               ir_graph *irg  = get_irn_irg(call);
-               ir_node *mem   = get_Call_mem(call);
-               ir_mode *mode  = get_type_mode(res_tp);
+               ir_graph *irg = get_irn_irg(call);
+               ir_mode *mode = get_type_mode(res_tp);
 
                irn = new_r_Const(irg, get_mode_null(mode));
                DBG_OPT_ALGSIM0(call, irn, FS_OPT_RTS_STRCMP);
@@ -898,7 +900,7 @@ int i_mapper_strcmp(ir_node *call, void *ctx)
        } else if (ent_r != NULL) {
                if (is_empty_string(ent_r)) {
                        /* s strcmp(s, "") ==> (*s) */
-                       ir_node  *mem, *block;
+                       ir_node  *block;
                        dbg_info *dbg;
                        ir_mode  *mode;
 
@@ -934,7 +936,6 @@ replace_by_call:
        }
 
        if (irn != NULL) {
-               ir_node *mem = get_Call_mem(call);
                DBG_OPT_ALGSIM0(call, irn, FS_OPT_RTS_STRCMP);
                replace_call(irn, call, mem, reg, exc);
                return 1;
@@ -1111,11 +1112,10 @@ int i_mapper_RuntimeCall(ir_node *node, runtime_rt *rt)
        int i, j, arity, first, n_param, n_res;
        long n_proj;
        ir_type *mtp;
-       ir_node *mem, *bl, *call, *addr, *res_proj;
+       ir_node *mem, *call, *addr, *res_proj;
        ir_node **in;
        bool     throws_exception;
        ir_op   *op;
-       ir_graph *irg;
        symconst_symbol sym;
        ir_mode *mode = get_irn_mode(node);
 
@@ -1134,7 +1134,8 @@ int i_mapper_RuntimeCall(ir_node *node, runtime_rt *rt)
 
        mtp     = get_entity_type(rt->ent);
        n_param = get_method_n_params(mtp);
-       irg     = current_ir_graph;
+       ir_node  *const bl  = get_nodes_block(node);
+       ir_graph *const irg = get_Block_irg(bl);
 
        mem = get_irn_n(node, 0);
        if (get_irn_mode(mem) != mode_M) {
@@ -1178,7 +1179,6 @@ int i_mapper_RuntimeCall(ir_node *node, runtime_rt *rt)
        }
 
        /* ok, when we are here, the number of predecessors match as well as the parameter modes */
-       bl = get_nodes_block(node);
        op = get_irn_op(node);
 
        in = NULL;