benode: Remove the parameter irg from be_new_Return().
authorChristoph Mallon <christoph.mallon@gmx.de>
Tue, 4 Dec 2012 15:16:04 +0000 (16:16 +0100)
committerChristoph Mallon <christoph.mallon@gmx.de>
Wed, 5 Dec 2012 09:03:03 +0000 (10:03 +0100)
Infer it from block.

ir/be/beabi.c
ir/be/beabihelper.c
ir/be/benode.c
ir/be/benode.h
ir/be/ia32/ia32_transform.c

index bd6c48d..365989e 100644 (file)
@@ -1251,7 +1251,7 @@ static ir_node *create_be_return(be_abi_irg_t *const env, ir_node *const irn)
 
        /* The in array for the new back end return is now ready. */
        dbg_info *const dbgi = get_irn_dbg_info(irn);
-       ir_node  *const ret  = be_new_Return(dbgi, irg, bl, n_res, call->pop, n, in);
+       ir_node  *const ret  = be_new_Return(dbgi, bl, n_res, call->pop, n, in);
 
        /* Set the register classes of the return's parameter accordingly. */
        for (i = 0; i < n; ++i) {
index 75ca7e8..77218f6 100644 (file)
@@ -358,12 +358,10 @@ ir_node *be_epilog_create_return(beabi_helper_env_t *env, dbg_info *dbgi,
        int       n_res       = 1; /* TODO */
        unsigned  pop         = 0; /* TODO */
        size_t    i;
-       ir_node  *ret;
 
        assert(ARR_LEN(env->epilog.value_map) == n_return_in);
 
-       ret = be_new_Return(dbgi, get_irn_irg(block), block, n_res, pop,
-                           n_return_in, in);
+       ir_node *const ret = be_new_Return(dbgi, block, n_res, pop, n_return_in, in);
        for (i = 0; i < n_return_in; ++i) {
                const reg_flag_t      *regflag = &env->epilog.regs[i];
                const arch_register_t *reg     = regflag->reg;
index e151145..53acdc5 100644 (file)
@@ -538,17 +538,14 @@ unsigned be_Call_get_pop(const ir_node *call)
        return a->pop;
 }
 
-ir_node *be_new_Return(dbg_info *dbg, ir_graph *irg, ir_node *block, int n_res,
-                       unsigned pop, int n, ir_node *in[])
+ir_node *be_new_Return(dbg_info *const dbg, ir_node *const block, int const n_res, unsigned const pop, int const n, ir_node **const in)
 {
-       be_return_attr_t *a;
-       ir_node *res;
-
-       res = new_ir_node(dbg, irg, block, op_be_Return, mode_X, n, in);
+       ir_graph *const irg = get_Block_irg(block);
+       ir_node  *const res = new_ir_node(dbg, irg, block, op_be_Return, mode_X, n, in);
        init_node_attr(res, n, 1);
        be_set_constr_out(res, 0, arch_no_register_req);
 
-       a = (be_return_attr_t*)get_irn_generic_attr(res);
+       be_return_attr_t *const a = (be_return_attr_t*)get_irn_generic_attr(res);
        a->num_ret_vals       = n_res;
        a->pop                = pop;
        a->emit_pop           = 0;
index a71cdc2..c8921ec 100644 (file)
@@ -323,15 +323,13 @@ enum {
  * Construct a new be_Return.
  *
  * @param dbg    debug info
- * @param irg    the graph where the new node will be placed
  * @param block  the block where the new node will be placed
  * @param n_res  number of "real" results
  * @param pop    pop number of bytes on return
  * @param n      number of inputs
  * @param in     input array
  */
-ir_node *be_new_Return(dbg_info *dbg, ir_graph *irg, ir_node *block, int n_res,
-                       unsigned pop, int n, ir_node *in[]);
+ir_node *be_new_Return(dbg_info *dbg, ir_node *block, int n_res, unsigned pop, int n, ir_node *in[]);
 
 /** Returns the number of real returns values */
 int be_Return_get_n_rets(const ir_node *ret);
index 134fd1c..aed1dd7 100644 (file)
@@ -3972,7 +3972,6 @@ static ir_node *gen_be_Return(ir_node *node)
        int        arity;
        unsigned   pop;
        ir_node  **in;
-       ir_node   *new_node;
 
        assert(ret_val != NULL);
        if (be_Return_get_n_rets(node) < 1 || ! ia32_cg_config.use_sse2) {
@@ -4025,7 +4024,7 @@ static ir_node *gen_be_Return(ir_node *node)
                        in[i] = be_transform_node(op);
                }
        }
-       new_node = be_new_Return(dbgi, irg, block, arity, pop, arity, in);
+       ir_node *const new_node = be_new_Return(dbgi, block, arity, pop, arity, in);
        copy_node_attr(irg, node, new_node);
 
        return new_node;