beloopana: Remove duplicate comments.
[libfirm] / ir / opt / escape_ana.c
index 5c90943..53151c5 100644 (file)
@@ -1,20 +1,6 @@
 /*
- * Copyright (C) 1995-2011 University of Karlsruhe.  All right reserved.
- *
  * This file is part of libFirm.
- *
- * This file may be distributed and/or modified under the terms of the
- * GNU General Public License version 2 as published by the Free Software
- * Foundation and appearing in the file LICENSE.GPL included in the
- * packaging of this file.
- *
- * Licensees holding valid libFirm Professional Edition licenses may use
- * this file in accordance with the libFirm Commercial License.
- * Agreement provided with the Software.
- *
- * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
- * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE.
+ * Copyright (C) 2012 University of Karlsruhe.
  */
 
 /**
@@ -38,6 +24,7 @@
 #include "irprintf.h"
 #include "debug.h"
 #include "error.h"
+#include "util.h"
 
 /**
  * walker environment
@@ -383,10 +370,12 @@ static void transform_allocs(ir_graph *irg, walk_env_t *env)
 
                mem = get_Alloc_mem(alloc);
                blk = get_nodes_block(alloc);
-               turn_into_tuple(alloc, pn_Alloc_max+1);
-               set_Tuple_pred(alloc, pn_Alloc_M, mem);
-               set_Tuple_pred(alloc, pn_Alloc_X_regular, new_r_Jmp(blk));
-               set_Tuple_pred(alloc, pn_Alloc_X_except, new_r_Bad(irg, mode_X));
+               ir_node *const in[] = {
+                       [pn_Alloc_M]         = mem,
+                       [pn_Alloc_X_regular] = new_r_Jmp(blk),
+                       [pn_Alloc_X_except]  = new_r_Bad(irg, mode_X),
+               };
+               turn_into_tuple(alloc, ARRAY_SIZE(in), in);
 
                ++env->nr_deads;
        }
@@ -428,11 +417,13 @@ static void transform_allocs(ir_graph *irg, walk_env_t *env)
                        sel = new_rd_simpleSel(dbg, get_nodes_block(alloc), get_irg_no_mem(irg), get_irg_frame(irg), ent);
                        mem = get_Alloc_mem(alloc);
 
-                       turn_into_tuple(alloc, pn_Alloc_max+1);
-                       set_Tuple_pred(alloc, pn_Alloc_M, mem);
-                       set_Tuple_pred(alloc, pn_Alloc_X_regular, new_r_Jmp(blk));
-                       set_Tuple_pred(alloc, pn_Alloc_X_except, new_r_Bad(irg, mode_X));
-                       set_Tuple_pred(alloc, pn_Alloc_res, sel);
+                       ir_node *const in[] = {
+                               [pn_Alloc_M]         = mem,
+                               [pn_Alloc_res]       = sel,
+                               [pn_Alloc_X_regular] = new_r_Jmp(blk),
+                               [pn_Alloc_X_except]  = new_r_Bad(irg, mode_X),
+                       };
+                       turn_into_tuple(alloc, ARRAY_SIZE(in), in);
 
                        ++env->nr_removed;
                }
@@ -450,8 +441,7 @@ static void transform_allocs(ir_graph *irg, walk_env_t *env)
 
        /* if allocs were removed somehow */
        if (env->nr_removed && env->nr_deads) {
-               /* exception control flow might have been changed */
-               clear_irg_properties(irg, IR_GRAPH_PROPERTY_CONSISTENT_DOMINANCE);
+               confirm_irg_properties(irg, IR_GRAPH_PROPERTIES_NONE);
        }
 }
 
@@ -471,11 +461,13 @@ static void transform_alloc_calls(ir_graph *irg, walk_env_t *env)
 
                mem = get_Call_mem(call);
                blk = get_nodes_block(call);
-               turn_into_tuple(call, pn_Call_max+1);
-               set_Tuple_pred(call, pn_Call_M,         mem);
-               set_Tuple_pred(call, pn_Call_X_regular, new_r_Jmp(blk));
-               set_Tuple_pred(call, pn_Call_X_except,  new_r_Bad(irg, mode_X));
-               set_Tuple_pred(call, pn_Call_T_result,  new_r_Bad(irg, mode_T));
+               ir_node *const in[] = {
+                       [pn_Call_M]         = mem,
+                       [pn_Call_T_result]  = new_r_Bad(irg, mode_T),
+                       [pn_Call_X_regular] = new_r_Jmp(blk),
+                       [pn_Call_X_except]  = new_r_Bad(irg, mode_X),
+               };
+               turn_into_tuple(call, ARRAY_SIZE(in), in);
 
                ++env->nr_deads;
        }
@@ -484,6 +476,8 @@ static void transform_alloc_calls(ir_graph *irg, walk_env_t *env)
        for (call = env->found_allocs; call; call = next) {
                next = (ir_node*)get_irn_link(call);
        }
+
+       confirm_irg_properties(irg, IR_GRAPH_PROPERTIES_NONE);
 }
 
 
@@ -551,7 +545,7 @@ void escape_analysis(int run_scalar_replace, check_alloc_entity_func callback)
        for (i = 0, n = get_irp_n_irgs(); i < n; ++i) {
                ir_graph *irg = get_irp_irg(i);
 
-               assure_irg_outs(irg);
+               assure_irg_properties(irg, IR_GRAPH_PROPERTY_CONSISTENT_OUTS);
 
                if (callback) {
                        /* search for Calls */