removed makro calls, dokumentation
[libfirm] / ir / ir / irgopt.c
index 4cb15d2..462c8de 100644 (file)
@@ -510,10 +510,13 @@ void remove_bad_predecessors(ir_graph *irg) {
 /*  Funcionality for inlining                                         */
 /**********************************************************************/
 
-/* Copy node for inlineing.  Copies the node by calling copy_node and
-   then updates the entity if it's a local one.  env must be a pointer
-   to the frame type of the procedure. The new entities must be in
-   the link field of the entities. */
+/* Copy node for inlineing.  Updates attributes that change when
+ * inlineing but not for dead node elimination.
+ *
+ * Copies the node by calling copy_node and then updates the entity if
+ * it's a local one.  env must be a pointer of the frame type of the
+ * inlined procedure. The new entities must be in the link field of
+ * the entities. */
 static INLINE void
 copy_node_inline (ir_node *n, void *env) {
   ir_node *new;
@@ -526,10 +529,12 @@ copy_node_inline (ir_node *n, void *env) {
     if (get_entity_owner(get_Sel_entity(n)) == frame_tp) {
       set_Sel_entity(new, get_entity_link(get_Sel_entity(n)));
     }
+  } else if (get_irn_op(n) == op_Block) {
+    new = get_new_node (n);
+    new->attr.block.irg = current_ir_graph;
   }
 }
 
-#include "irdump.h"
 
 void inline_method(ir_node *call, ir_graph *called_graph) {
   ir_node *pre_call;
@@ -778,7 +783,7 @@ void inline_method(ir_node *call, ir_graph *called_graph) {
       if (get_irn_op(cf_op) == op_Proj) {
        cf_op = get_Proj_pred(cf_op);
        if ((get_irn_op(cf_op) == op_Tuple) && (cf_op == call)) {
-           // There are unoptimized tuples from inlineing before when no exc
+         // There are unoptimized tuples from inlineing before when no exc
          assert(get_Proj_proj(get_Block_cfgpred(end_bl, i)) == pn_Call_X_except);
          cf_op = get_Tuple_pred(cf_op, pn_Call_X_except);
          assert(get_irn_op(cf_op) == op_Jmp);
@@ -799,6 +804,8 @@ void inline_method(ir_node *call, ir_graph *called_graph) {
        cf_pred[j] = get_Block_cfgpred(end_bl, j-get_Block_n_cfgpreds(bl) +1);
       set_irn_in(end_bl, arity, cf_pred);
       free(cf_pred);
+      // Remove the exception pred from post-call Tuple.
+      set_Tuple_pred(call, pn_Call_X_except, new_Bad());
     }
   }
 
@@ -887,8 +894,6 @@ void inline_small_irgs(ir_graph *irg, int size) {
 /*  will be executed only if needed.                                */
 /********************************************************************/
 
-#include "irdump.h"
-
 static pdeq *worklist;         /* worklist of ir_node*s */
 
 /* Find the earliest correct block for N.  --- Place N into the