BugFix: set_irn_n() should now work for the block input (-1)
[libfirm] / ir / ir / irnode.c
index 62bce90..5e3ba55 100644 (file)
@@ -159,16 +159,16 @@ new_ir_node (dbg_info *db, ir_graph *irg, ir_node *block, ir_op *op, ir_mode *mo
 
 #if FIRM_EDGES_INPLACE
   {
-    int i, n;
-    int not_a_block = is_no_Block(res);
+    int i;
+    int is_bl = is_Block(res);
 
     INIT_LIST_HEAD(&res->edge_info.outs_head);
-    if(!not_a_block)
+    if(is_bl)
       INIT_LIST_HEAD(&res->attr.block.succ_head);
 
 
-    for (i = 0, n = arity + not_a_block; i < n; ++i)
-      edges_notify_edge(res, i - not_a_block, res->in[i], NULL, irg);
+    for (i = is_bl; i <= arity; ++i)
+      edges_notify_edge(res, i - 1, res->in[i], NULL, irg);
   }
 #endif
 
@@ -631,12 +631,12 @@ get_Block_cfgpred_arr (ir_node *node)
 
 int
 (get_Block_n_cfgpreds)(ir_node *node) {
-  return get_Block_n_cfgpreds(node);
+  return _get_Block_n_cfgpreds(node);
 }
 
 ir_node *
 (get_Block_cfgpred)(ir_node *node, int pos) {
-  return get_Block_cfgpred(node, pos);
+  return _get_Block_cfgpred(node, pos);
 }
 
 void
@@ -749,22 +749,19 @@ int (is_Block_dead)(const ir_node *block) {
 }
 
 ir_extblk *get_Block_extbb(const ir_node *block) {
+       ir_extblk *res;
   assert(is_Block(block));
-  return block->attr.block.extblk;
+       res = block->attr.block.extblk;
+       assert(res == NULL || is_ir_extbb(res));
+  return res;
 }
 
 void set_Block_extbb(ir_node *block, ir_extblk *extblk) {
   assert(is_Block(block));
+       assert(extblk == NULL || is_ir_extbb(extblk));
   block->attr.block.extblk = extblk;
 }
 
-void
-set_Start_irg(ir_node *node, ir_graph *irg) {
-  assert(node->op == op_Start);
-  assert(is_ir_graph(irg));
-  assert(0 && " Why set irg? -- use set_irn_irg");
-}
-
 int
 get_End_n_keepalives(ir_node *end) {
   assert (end->op == op_End);