avoid unnecessary passing around of arch_env_t* in backend APIs
[libfirm] / ir / be / benode.c
index 62bf8fc..3383f38 100644 (file)
@@ -37,7 +37,6 @@
 #include "util.h"
 #include "debug.h"
 #include "fourcc.h"
-#include "offset.h"
 #include "bitfiddle.h"
 #include "raw_bitset.h"
 #include "error.h"
@@ -120,7 +119,7 @@ ir_op *op_be_Return;
 ir_op *op_be_IncSP;
 ir_op *op_be_AddSP;
 ir_op *op_be_SubSP;
-ir_op *op_be_RegParams;
+ir_op *op_be_Start;
 ir_op *op_be_FrameAddr;
 ir_op *op_be_Barrier;
 
@@ -205,7 +204,8 @@ static int Return_cmp_attr(ir_node *a, ir_node *b)
  *
  * @return zero if both nodes have identically attributes
  */
-static int IncSP_cmp_attr(ir_node *a, ir_node *b) {
+static int IncSP_cmp_attr(ir_node *a, ir_node *b)
+{
        const be_incsp_attr_t *a_attr = get_irn_attr_const(a);
        const be_incsp_attr_t *b_attr = get_irn_attr_const(b);
 
@@ -235,7 +235,7 @@ static int Call_cmp_attr(ir_node *a, ir_node *b)
 static arch_register_req_t *allocate_reg_req(const ir_node *node)
 {
        ir_graph       *irg  = get_irn_irg(node);
-       struct obstack *obst = be_get_birg_obst(irg);
+       struct obstack *obst = be_get_be_obst(irg);
 
        arch_register_req_t *req = obstack_alloc(obst, sizeof(*req));
        memset(req, 0, sizeof(*req));
@@ -262,7 +262,7 @@ void be_set_constr_out(ir_node *node, int pos, const arch_register_req_t *req)
 static void *init_node_attr(ir_node *node, int n_inputs, int n_outputs)
 {
        ir_graph       *irg  = get_irn_irg(node);
-       struct obstack *obst = be_get_birg_obst(irg);
+       struct obstack *obst = be_get_be_obst(irg);
        be_node_attr_t *a    = get_irn_attr(node);
        backend_info_t *info = be_get_info(node);
 
@@ -328,15 +328,16 @@ ir_node *be_new_Spill(const arch_register_class_t *cls,
 
        be_node_set_reg_class_in(res, be_pos_Spill_frame, cls_frame);
        be_node_set_reg_class_in(res, be_pos_Spill_val, cls);
-
        /*
         * For spills and reloads, we return "none" as requirement for frame
-        * pointer, so every input is ok. Some backends need this (e.g. STA).
+        * pointer, so every input is ok. Some backends need this (STA).
         * Matze: we should investigate if this is really needed, this solution
         *        looks very hacky to me
         */
        be_set_constr_in(res, be_pos_Spill_frame, arch_no_register_req);
 
+       arch_set_out_register_req(res, 0, arch_no_register_req);
+
        return res;
 }
 
@@ -352,8 +353,9 @@ ir_node *be_new_Reload(const arch_register_class_t *cls,
        in[1] = mem;
        res   = new_ir_node(NULL, irg, block, op_be_Reload, mode, 2, in);
 
-       init_node_attr(res, 2, 2);
+       init_node_attr(res, 2, 1);
        be_node_set_reg_class_out(res, 0, cls);
+
        be_node_set_reg_class_in(res, be_pos_Reload_frame, cls_frame);
        arch_irn_set_flags(res, arch_irn_flags_rematerializable);
 
@@ -439,31 +441,26 @@ void be_Perm_reduce(ir_node *perm, int new_size, int *map)
        set_irn_in(perm, new_size, new_in);
 }
 
-ir_node *be_new_MemPerm(const arch_env_t *arch_env, ir_node *bl, int n, ir_node *in[])
+ir_node *be_new_MemPerm(ir_node *block, int n, ir_node *in[])
 {
-       ir_graph                     *irg       = get_Block_irg(bl);
+       ir_graph                     *irg       = get_Block_irg(block);
+       const arch_env_t             *arch_env  = be_get_irg_arch_env(irg);
        ir_node                      *frame     = get_irg_frame(irg);
-       const arch_register_class_t  *cls_frame = arch_get_irn_reg_class_out(frame);
        const arch_register_t        *sp        = arch_env->sp;
        ir_node                      *irn;
        be_memperm_attr_t            *attr;
        ir_node                     **real_in;
-       int                           i;
 
        real_in = ALLOCAN(ir_node*, n + 1);
        real_in[0] = frame;
        memcpy(&real_in[1], in, n * sizeof(real_in[0]));
 
-       irn =  new_ir_node(NULL, irg, bl, op_be_MemPerm, mode_T, n+1, real_in);
+       irn = new_ir_node(NULL, irg, block, op_be_MemPerm, mode_T, n+1, real_in);
 
-       init_node_attr(irn, n + 1, n + 1);
+       init_node_attr(irn, n + 1, n);
        be_node_set_reg_class_in(irn, 0, sp->reg_class);
-       for (i = 0; i < n; ++i) {
-               be_node_set_reg_class_in(irn, i + 1, cls_frame);
-               be_node_set_reg_class_out(irn, i, cls_frame);
-       }
 
-       attr = get_irn_attr(irn);
+       attr               = get_irn_attr(irn);
        attr->in_entities  = OALLOCNZ(irg->obst, ir_entity*, n);
        attr->out_entities = OALLOCNZ(irg->obst, ir_entity*, n);
 
@@ -492,11 +489,13 @@ ir_node *be_new_Copy(const arch_register_class_t *cls, ir_node *bl, ir_node *op)
        return res;
 }
 
-ir_node *be_get_Copy_op(const ir_node *cpy) {
+ir_node *be_get_Copy_op(const ir_node *cpy)
+{
        return get_irn_n(cpy, be_pos_Copy_op);
 }
 
-void be_set_Copy_op(ir_node *cpy, ir_node *op) {
+void be_set_Copy_op(ir_node *cpy, ir_node *op)
+{
        set_irn_n(cpy, be_pos_Copy_op, op);
 }
 
@@ -553,39 +552,45 @@ ir_node *be_new_Call(dbg_info *dbg, ir_graph *irg, ir_node *bl, ir_node *mem,
 }
 
 /* Gets the call entity or NULL if this is no static call. */
-ir_entity *be_Call_get_entity(const ir_node *call) {
+ir_entity *be_Call_get_entity(const ir_node *call)
+{
        const be_call_attr_t *a = get_irn_attr_const(call);
        assert(be_is_Call(call));
        return a->ent;
 }
 
 /* Sets the call entity. */
-void be_Call_set_entity(ir_node *call, ir_entity *ent) {
+void be_Call_set_entity(ir_node *call, ir_entity *ent)
+{
        be_call_attr_t *a = get_irn_attr(call);
        assert(be_is_Call(call));
        a->ent = ent;
 }
 
 /* Gets the call type. */
-ir_type *be_Call_get_type(ir_node *call) {
+ir_type *be_Call_get_type(ir_node *call)
+{
        const be_call_attr_t *a = get_irn_attr_const(call);
        assert(be_is_Call(call));
        return a->call_tp;
 }
 
 /* Sets the call type. */
-void be_Call_set_type(ir_node *call, ir_type *call_tp) {
+void be_Call_set_type(ir_node *call, ir_type *call_tp)
+{
        be_call_attr_t *a = get_irn_attr(call);
        assert(be_is_Call(call));
        a->call_tp = call_tp;
 }
 
-void be_Call_set_pop(ir_node *call, unsigned pop) {
+void be_Call_set_pop(ir_node *call, unsigned pop)
+{
        be_call_attr_t *a = get_irn_attr(call);
        a->pop = pop;
 }
 
-unsigned be_Call_get_pop(const ir_node *call) {
+unsigned be_Call_get_pop(const ir_node *call)
+{
        const be_call_attr_t *a = get_irn_attr_const(call);
        return a->pop;
 }
@@ -615,30 +620,35 @@ ir_node *be_new_Return(dbg_info *dbg, ir_graph *irg, ir_node *block, int n_res,
 }
 
 /* Returns the number of real returns values */
-int be_Return_get_n_rets(const ir_node *ret) {
+int be_Return_get_n_rets(const ir_node *ret)
+{
        const be_return_attr_t *a = get_irn_generic_attr_const(ret);
        return a->num_ret_vals;
 }
 
 /* return the number of bytes that should be popped from stack when executing the Return. */
-unsigned be_Return_get_pop(const ir_node *ret) {
+unsigned be_Return_get_pop(const ir_node *ret)
+{
        const be_return_attr_t *a = get_irn_generic_attr_const(ret);
        return a->pop;
 }
 
 /* return non-zero, if number of popped bytes must be always emitted */
-int be_Return_get_emit_pop(const ir_node *ret) {
+int be_Return_get_emit_pop(const ir_node *ret)
+{
        const be_return_attr_t *a = get_irn_generic_attr_const(ret);
        return a->emit_pop;
 }
 
 /* return non-zero, if number of popped bytes must be always emitted */
-void be_Return_set_emit_pop(ir_node *ret, int emit_pop) {
+void be_Return_set_emit_pop(ir_node *ret, int emit_pop)
+{
        be_return_attr_t *a = get_irn_generic_attr(ret);
        a->emit_pop = emit_pop;
 }
 
-int be_Return_append_node(ir_node *ret, ir_node *node) {
+int be_Return_append_node(ir_node *ret, ir_node *node)
+{
        int pos;
 
        pos = add_irn_n(ret, node);
@@ -717,13 +727,13 @@ ir_node *be_new_SubSP(const arch_register_t *sp, ir_node *bl, ir_node *old_sp, i
        return irn;
 }
 
-ir_node *be_new_RegParams(ir_node *bl, int n_outs)
+ir_node *be_new_Start(dbg_info *dbgi, ir_node *bl, int n_outs)
 {
        ir_node *res;
        int i;
        ir_graph *irg = get_Block_irg(bl);
 
-       res = new_ir_node(NULL, irg, bl, op_be_RegParams, mode_T, 0, NULL);
+       res = new_ir_node(dbgi, irg, bl, op_be_Start, mode_T, 0, NULL);
        init_node_attr(res, 0, -1);
        for (i = 0; i < n_outs; ++i) {
                add_register_req_out(res);
@@ -750,7 +760,8 @@ ir_node *be_new_FrameAddr(const arch_register_class_t *cls_frame, ir_node *bl, i
        return optimize_node(irn);
 }
 
-ir_node *be_get_FrameAddr_frame(const ir_node *node) {
+ir_node *be_get_FrameAddr_frame(const ir_node *node)
+{
        assert(be_is_FrameAddr(node));
        return get_irn_n(node, be_pos_FrameAddr_ptr);
 }
@@ -782,11 +793,13 @@ ir_node *be_new_CopyKeep_single(const arch_register_class_t *cls, ir_node *bl, i
        return be_new_CopyKeep(cls, bl, src, 1, &keep, mode);
 }
 
-ir_node *be_get_CopyKeep_op(const ir_node *cpy) {
+ir_node *be_get_CopyKeep_op(const ir_node *cpy)
+{
        return get_irn_n(cpy, be_pos_CopyKeep_op);
 }
 
-void be_set_CopyKeep_op(ir_node *cpy, ir_node *op) {
+void be_set_CopyKeep_op(ir_node *cpy, ir_node *op)
+{
        set_irn_n(cpy, be_pos_CopyKeep_op, op);
 }
 
@@ -809,26 +822,25 @@ ir_node *be_new_Barrier(ir_node *bl, int n, ir_node *in[])
 
 ir_node *be_Barrier_append_node(ir_node *barrier, ir_node *node)
 {
-       ir_node *block = get_nodes_block(barrier);
        ir_mode *mode = get_irn_mode(node);
        int n = add_irn_n(barrier, node);
 
-       ir_node *proj = new_r_Proj(block, barrier, mode, n);
+       ir_node *proj = new_r_Proj(barrier, mode, n);
        add_register_req_in(barrier);
        add_register_req_out(barrier);
 
        return proj;
 }
 
-int be_has_frame_entity(const ir_node *irn)
+static bool be_has_frame_entity(const ir_node *irn)
 {
        switch (get_irn_opcode(irn)) {
        case beo_Spill:
        case beo_Reload:
        case beo_FrameAddr:
-               return 1;
+               return true;
        default:
-               return 0;
+               return false;
        }
 }
 
@@ -896,7 +908,7 @@ int be_get_MemPerm_entity_arity(const ir_node *irn)
        return get_irn_arity(irn) - 1;
 }
 
-static const arch_register_req_t *get_single_req(struct obstack *obst,
+const arch_register_req_t *be_create_reg_req(struct obstack *obst,
                const arch_register_t *reg, arch_register_req_type_t additional_types)
 {
        arch_register_req_t         *req = obstack_alloc(obst, sizeof(*req));
@@ -921,8 +933,8 @@ void be_set_constr_single_reg_in(ir_node *node, int pos,
                req = reg->single_req;
        } else {
                ir_graph       *irg  = get_irn_irg(node);
-               struct obstack *obst = be_get_birg_obst(irg);
-               req = get_single_req(obst, reg, additional_types);
+               struct obstack *obst = be_get_be_obst(irg);
+               req = be_create_reg_req(obst, reg, additional_types);
        }
        be_set_constr_in(node, pos, req);
 }
@@ -941,8 +953,8 @@ void be_set_constr_single_reg_out(ir_node *node, int pos,
                req = reg->single_req;
        } else {
                ir_graph       *irg  = get_irn_irg(node);
-               struct obstack *obst = be_get_birg_obst(irg);
-               req = get_single_req(obst, reg, additional_types);
+               struct obstack *obst = be_get_be_obst(irg);
+               req = be_create_reg_req(obst, reg, additional_types);
        }
 
        arch_irn_set_register(node, pos, reg);
@@ -961,12 +973,14 @@ void be_node_set_reg_class_out(ir_node *irn, int pos,
        be_set_constr_out(irn, pos, cls->class_req);
 }
 
-ir_node *be_get_IncSP_pred(ir_node *irn) {
+ir_node *be_get_IncSP_pred(ir_node *irn)
+{
        assert(be_is_IncSP(irn));
        return get_irn_n(irn, 0);
 }
 
-void be_set_IncSP_pred(ir_node *incsp, ir_node *pred) {
+void be_set_IncSP_pred(ir_node *incsp, ir_node *pred)
+{
        assert(be_is_IncSP(incsp));
        set_irn_n(incsp, 0, pred);
 }
@@ -1037,14 +1051,6 @@ ir_node *be_reload(const arch_register_class_t *cls, ir_node *insert, ir_mode *m
 */
 
 
-static const arch_register_req_t *be_node_get_out_reg_req(
-               const ir_node *irn, int pos)
-{
-       const backend_info_t *info = be_get_info(irn);
-       assert(pos < ARR_LEN(info->out_infos));
-       return info->out_infos[pos].req;
-}
-
 static const arch_register_req_t *be_node_get_in_reg_req(
                const ir_node *irn, int pos)
 {
@@ -1073,7 +1079,7 @@ static ir_entity *be_node_get_frame_entity(const ir_node *irn)
        return be_get_frame_entity(irn);
 }
 
-static void be_node_set_frame_entity(ir_node *irn, ir_entity *ent)
+void be_node_set_frame_entity(ir_node *irn, ir_entity *ent)
 {
        be_frame_attr_t *a;
 
@@ -1116,10 +1122,8 @@ static int be_node_get_sp_bias(const ir_node *irn)
 /* for be nodes */
 static const arch_irn_ops_t be_node_irn_ops = {
        be_node_get_in_reg_req,
-       be_node_get_out_reg_req,
        be_node_classify,
        be_node_get_frame_entity,
-       be_node_set_frame_entity,
        be_node_set_frame_offset,
        be_node_get_sp_bias,
        NULL,    /* get_inverse             */
@@ -1148,13 +1152,6 @@ static ir_entity* dummy_get_frame_entity(const ir_node *node)
        return NULL;
 }
 
-static void dummy_set_frame_entity(ir_node *node, ir_entity *entity)
-{
-       (void) node;
-       (void) entity;
-       panic("dummy_set_frame_entity() should not be called");
-}
-
 static void dummy_set_frame_offset(ir_node *node, int bias)
 {
        (void) node;
@@ -1170,11 +1167,9 @@ static int dummy_get_sp_bias(const ir_node *node)
 
 /* for "middleend" nodes */
 static const arch_irn_ops_t dummy_be_irn_ops = {
-       dummy_reg_req,
        dummy_reg_req,
        dummy_classify,
        dummy_get_frame_entity,
-       dummy_set_frame_entity,
        dummy_set_frame_offset,
        dummy_get_sp_bias,
        NULL,      /* get_inverse           */
@@ -1192,6 +1187,25 @@ static const arch_irn_ops_t dummy_be_irn_ops = {
 
 */
 
+ir_node *be_new_Phi(ir_node *block, int n_ins, ir_node **ins, ir_mode *mode,
+                    const arch_register_class_t *cls)
+{
+       struct obstack *obst = be_get_be_obst(get_irn_irg(block));
+       backend_info_t *info;
+
+       ir_node *phi = new_r_Phi(block, n_ins, ins, mode);
+       info = be_get_info(phi);
+       info->out_infos = NEW_ARR_D(reg_out_info_t, obst, 1);
+       memset(info->out_infos, 0, 1 * sizeof(info->out_infos[0]));
+       if (cls == NULL) {
+               info->out_infos[0].req = arch_no_register_req;
+       } else {
+               info->out_infos[0].req = cls->class_req;
+       }
+
+       return phi;
+}
+
 /**
  * Guess correct register class of a phi node by looking at its arguments
  */
@@ -1267,13 +1281,9 @@ void be_set_phi_reg_req(ir_node *node, const arch_register_req_t *req)
        assert(mode_is_datab(get_irn_mode(node)));
 }
 
-int be_dump_phi_reg_reqs(ir_node *node, FILE *F, dump_reason_t reason)
+void be_dump_phi_reg_reqs(FILE *F, ir_node *node, dump_reason_t reason)
 {
-       backend_info_t *info;
-       int i;
-       int arity;
-
-       switch(reason) {
+       switch (reason) {
        case dump_node_opcode_txt:
                fputs(get_op_name(get_irn_op(node)), F);
                break;
@@ -1283,45 +1293,23 @@ int be_dump_phi_reg_reqs(ir_node *node, FILE *F, dump_reason_t reason)
        case dump_node_nodeattr_txt:
                break;
        case dump_node_info_txt:
-               info = be_get_info(node);
-
-               /* we still have a little problem with the initialisation order. This
-                  dump function is attached to the Phi ops before we can be sure
-                  that all backend infos have been constructed... */
-               if (info != NULL) {
-                       const arch_register_req_t *req = info->out_infos[0].req;
-                       const arch_register_t     *reg = arch_irn_get_register(node, 0);
-
-                       arity = get_irn_arity(node);
-                       for (i = 0; i < arity; ++i) {
-                               fprintf(F, "inreq #%d = ", i);
-                               arch_dump_register_req(F, req, node);
-                               fputs("\n", F);
-                       }
-                       fprintf(F, "outreq #0 = ");
-                       arch_dump_register_req(F, req, node);
-                       fputs("\n", F);
-
-                       fputs("\n", F);
-
-                       fprintf(F, "reg #0 = %s\n", reg != NULL ? reg->name : "n/a");
+       {
+               backend_info_t *info = be_get_info(node);
+               if (info != NULL && info->out_infos[0].req != NULL) {
+                       arch_dump_reqs_and_registers(F, node);
                }
-
                break;
+       }
 
        default:
                break;
        }
-
-       return 0;
 }
 
 static const arch_irn_ops_t phi_irn_ops = {
-       phi_get_irn_reg_req,
        phi_get_irn_reg_req,
        dummy_classify,
        dummy_get_frame_entity,
-       dummy_set_frame_entity,
        dummy_set_frame_offset,
        dummy_get_sp_bias,
        NULL,    /* get_inverse             */
@@ -1339,63 +1327,25 @@ static const arch_irn_ops_t phi_irn_ops = {
                                                 |_|            |___/
 */
 
-/**
- * Dumps node register requirements to a file.
- */
-static void dump_node_reqs(FILE *F, ir_node *node)
-{
-       int i;
-       be_node_attr_t *a = get_irn_attr(node);
-       int len = ARR_LEN(a->reg_data);
-       const backend_info_t *info = be_get_info(node);
-
-       for (i = 0; i < len; ++i) {
-               const arch_register_req_t *req = a->reg_data[i].in_req;
-               if (req->cls == NULL)
-                       continue;
-               fprintf(F, "inreq #%d = ", i);
-               arch_dump_register_req(F, req, node);
-               fputs("\n", F);
-       }
-
-       for (i = 0; i < len; ++i) {
-               const arch_register_req_t *req = info->out_infos[i].req;
-               if (req->cls == NULL)
-                       continue;
-               fprintf(F, "outreq #%d = ", i);
-               arch_dump_register_req(F, req, node);
-               fputs("\n", F);
-       }
-
-       fputs("\n", F);
-
-       for (i = 0; i < len; ++i) {
-               const arch_register_t *reg = arch_irn_get_register(node, i);
-               fprintf(F, "reg #%d = %s\n", i, reg != NULL ? reg->name : "n/a");
-       }
-}
-
 /**
  * ir_op-Operation: dump a be node to file
  */
-static int dump_node(ir_node *irn, FILE *f, dump_reason_t reason)
+static void dump_node(FILE *f, ir_node *irn, dump_reason_t reason)
 {
-       be_node_attr_t *at = get_irn_attr(irn);
-
        assert(is_be_node(irn));
 
-       switch(reason) {
+       switch (reason) {
                case dump_node_opcode_txt:
                        fputs(get_op_name(get_irn_op(irn)), f);
                        break;
                case dump_node_mode_txt:
-                       if (be_is_Perm(irn) || be_is_Copy(irn) || be_is_CopyKeep(irn)) {
-                               fprintf(f, " %s", get_mode_name(get_irn_mode(irn)));
+                       if (be_is_Copy(irn) || be_is_CopyKeep(irn)) {
+                               fprintf(f, "%s", get_mode_name(get_irn_mode(irn)));
                        }
                        break;
                case dump_node_nodeattr_txt:
                        if (be_is_Call(irn)) {
-                               be_call_attr_t *a = (be_call_attr_t *) at;
+                               const be_call_attr_t *a = get_irn_generic_attr_const(irn);
                                if (a->ent)
                                        fprintf(f, " [%s] ", get_entity_name(a->ent));
                        }
@@ -1411,10 +1361,10 @@ static int dump_node(ir_node *irn, FILE *f, dump_reason_t reason)
                        }
                        break;
                case dump_node_info_txt:
-                       dump_node_reqs(f, irn);
+                       arch_dump_reqs_and_registers(f, irn);
 
                        if (be_has_frame_entity(irn)) {
-                               be_frame_attr_t *a = (be_frame_attr_t *) at;
+                               const be_frame_attr_t *a = get_irn_generic_attr_const(irn);
                                if (a->ent) {
                                        unsigned size = get_type_size_bytes(get_entity_type(a->ent));
                                        ir_fprintf(f, "frame entity: %+F, offset 0x%x (%d), size 0x%x (%d) bytes\n",
@@ -1424,60 +1374,55 @@ static int dump_node(ir_node *irn, FILE *f, dump_reason_t reason)
                        }
 
                        switch (get_irn_opcode(irn)) {
-                       case beo_IncSP:
-                               {
-                                       be_incsp_attr_t *a = (be_incsp_attr_t *) at;
-                                       if (a->offset == BE_STACK_FRAME_SIZE_EXPAND)
-                                               fprintf(f, "offset: FRAME_SIZE\n");
-                                       else if (a->offset == BE_STACK_FRAME_SIZE_SHRINK)
-                                               fprintf(f, "offset: -FRAME SIZE\n");
-                                       else
-                                               fprintf(f, "offset: %u\n", a->offset);
-                               }
+                       case beo_IncSP: {
+                               const be_incsp_attr_t *a = get_irn_generic_attr_const(irn);
+                               fprintf(f, "align: %d\n", a->align);
+                               if (a->offset == BE_STACK_FRAME_SIZE_EXPAND)
+                                       fprintf(f, "offset: FRAME_SIZE\n");
+                               else if (a->offset == BE_STACK_FRAME_SIZE_SHRINK)
+                                       fprintf(f, "offset: -FRAME SIZE\n");
+                               else
+                                       fprintf(f, "offset: %d\n", a->offset);
                                break;
-                       case beo_Call:
-                               {
-                                       be_call_attr_t *a = (be_call_attr_t *) at;
+                       }
+                       case beo_Call: {
+                               const be_call_attr_t *a = get_irn_generic_attr_const(irn);
 
-                                       if (a->ent)
-                                               fprintf(f, "\ncalling: %s\n", get_entity_name(a->ent));
-                               }
+                               if (a->ent)
+                                       fprintf(f, "\ncalling: %s\n", get_entity_name(a->ent));
                                break;
-                       case beo_MemPerm:
-                               {
-                                       int i;
-                                       for (i = 0; i < be_get_MemPerm_entity_arity(irn); ++i) {
-                                               ir_entity *in, *out;
-                                               in = be_get_MemPerm_in_entity(irn, i);
-                                               out = be_get_MemPerm_out_entity(irn, i);
-                                               if (in) {
-                                                       fprintf(f, "\nin[%d]: %s\n", i, get_entity_name(in));
-                                               }
-                                               if (out) {
-                                                       fprintf(f, "\nout[%d]: %s\n", i, get_entity_name(out));
-                                               }
+                       }
+                       case beo_MemPerm: {
+                               int i;
+                               for (i = 0; i < be_get_MemPerm_entity_arity(irn); ++i) {
+                                       ir_entity *in, *out;
+                                       in = be_get_MemPerm_in_entity(irn, i);
+                                       out = be_get_MemPerm_out_entity(irn, i);
+                                       if (in) {
+                                               fprintf(f, "\nin[%d]: %s\n", i, get_entity_name(in));
+                                       }
+                                       if (out) {
+                                               fprintf(f, "\nout[%d]: %s\n", i, get_entity_name(out));
                                        }
                                }
                                break;
+                       }
 
                        default:
                                break;
                        }
        }
-
-       return 0;
 }
 
 /**
  * ir_op-Operation:
  * Copies the backend specific attributes from old node to new node.
  */
-static void copy_attr(const ir_node *old_node, ir_node *new_node)
+static void copy_attr(ir_graph *irg, const ir_node *old_node, ir_node *new_node)
 {
        const be_node_attr_t *old_attr = get_irn_attr_const(old_node);
        be_node_attr_t *new_attr = get_irn_attr(new_node);
-       ir_graph       *irg      = get_irn_irg(new_node);
-       struct obstack *obst     = be_get_birg_obst(irg);
+       struct obstack *obst     = be_get_be_obst(irg);
        backend_info_t *old_info = be_get_info(old_node);
        backend_info_t *new_info = be_get_info(new_node);
 
@@ -1489,8 +1434,7 @@ static void copy_attr(const ir_node *old_node, ir_node *new_node)
        if (old_info->out_infos != NULL) {
                unsigned n_outs = ARR_LEN(old_info->out_infos);
                /* need dyanmic out infos? */
-               if (be_is_RegParams(new_node) || be_is_Barrier(new_node)
-                               || be_is_Perm(new_node)) {
+               if (be_is_Barrier(new_node)     || be_is_Perm(new_node)) {
                        new_info->out_infos = NEW_ARR_F(reg_out_info_t, n_outs);
                } else {
                        new_info->out_infos = NEW_ARR_D(reg_out_info_t, obst, n_outs);
@@ -1560,7 +1504,7 @@ void be_init_op(void)
        op_be_AddSP      = new_ir_op(beo_AddSP,     "be_AddSP",     op_pin_state_pinned, N,   oparity_unary,    0, sizeof(be_node_attr_t),    &be_node_op_ops);
        op_be_SubSP      = new_ir_op(beo_SubSP,     "be_SubSP",     op_pin_state_pinned, N,   oparity_unary,    0, sizeof(be_node_attr_t),    &be_node_op_ops);
        op_be_IncSP      = new_ir_op(beo_IncSP,     "be_IncSP",     op_pin_state_pinned, N,   oparity_unary,    0, sizeof(be_incsp_attr_t),   &be_node_op_ops);
-       op_be_RegParams  = new_ir_op(beo_RegParams, "be_RegParams", op_pin_state_pinned, N,   oparity_zero,     0, sizeof(be_node_attr_t),    &be_node_op_ops);
+       op_be_Start      = new_ir_op(beo_Start,     "be_Start",     op_pin_state_pinned, N,   oparity_zero,     0, sizeof(be_node_attr_t),    &be_node_op_ops);
        op_be_FrameAddr  = new_ir_op(beo_FrameAddr, "be_FrameAddr", op_pin_state_floats, N,   oparity_unary,    0, sizeof(be_frame_attr_t),   &be_node_op_ops);
        op_be_Barrier    = new_ir_op(beo_Barrier,   "be_Barrier",   op_pin_state_pinned, N,   oparity_dynamic,  0, sizeof(be_node_attr_t),    &be_node_op_ops);
 
@@ -1576,7 +1520,7 @@ void be_init_op(void)
        op_be_AddSP->ops.node_cmp_attr     = node_cmp_attr;
        op_be_SubSP->ops.node_cmp_attr     = node_cmp_attr;
        op_be_IncSP->ops.node_cmp_attr     = IncSP_cmp_attr;
-       op_be_RegParams->ops.node_cmp_attr = node_cmp_attr;
+       op_be_Start->ops.node_cmp_attr     = node_cmp_attr;
        op_be_FrameAddr->ops.node_cmp_attr = FrameAddr_cmp_attr;
        op_be_Barrier->ops.node_cmp_attr   = node_cmp_attr;