switch scalar replacement to new style debug output
[libfirm] / ir / opt / opt_inline.c
index c57eccf..0fd8328 100644 (file)
@@ -50,6 +50,7 @@
 #include "irouts.h"
 #include "irloop_t.h"
 #include "irbackedge_t.h"
+#include "opt_inline_t.h"
 #include "cgana.h"
 #include "trouts.h"
 #include "error.h"
@@ -60,6 +61,7 @@
 #include "irhooks.h"
 #include "irtools.h"
 
+DEBUG_ONLY(static firm_dbg_module_t *dbg;)
 
 /*------------------------------------------------------------------*/
 /* Routines for dead node elimination / copying garbage collection  */
@@ -1212,9 +1214,6 @@ void inline_small_irgs(ir_graph *irg, int size) {
   ir_graph *rem = current_ir_graph;
        inline_env_t env;
        call_entry *entry;
-       DEBUG_ONLY(firm_dbg_module_t *dbg;)
-
-       FIRM_DBG_REGISTER(dbg, "firm.opt.inline");
 
        current_ir_graph = irg;
        /* Handle graph state */
@@ -1231,15 +1230,23 @@ void inline_small_irgs(ir_graph *irg, int size) {
        irg_walk_graph(irg, NULL, collect_calls, &env);
 
        if (env.head != NULL) {
+               int did_inline = 0;
+
                /* There are calls to inline */
                collect_phiprojs(irg);
                for (entry = env.head; entry != NULL; entry = entry->next) {
                        ir_graph *callee = entry->callee;
                        if (((_obstack_memory_used(callee->obst) - (int)obstack_room(callee->obst)) < size) ||
                            (get_irg_inline_property(callee) >= irg_inline_forced)) {
-                               inline_method(entry->call, callee);
+                               did_inline |= inline_method(entry->call, callee);
                        }
                }
+               if (did_inline != 0) {
+                       /* this irg got calls inlined */
+                       set_irg_outs_inconsistent(irg);
+                       set_irg_doms_inconsistent(irg);
+                       set_irg_loopinfo_inconsistent(irg);
+               }
        }
        obstack_free(&env.obst, NULL);
        current_ir_graph = rem;
@@ -1406,9 +1413,7 @@ void inline_leave_functions(int maxsize, int leavesize, int size, int ignore_run
        const call_entry *centry;
        pmap             *copied_graphs;
        pmap_entry       *pm_entry;
-       DEBUG_ONLY(firm_dbg_module_t *dbg;)
 
-       FIRM_DBG_REGISTER(dbg, "firm.opt.inline");
        rem = current_ir_graph;
        obstack_init(&temp_obst);
 
@@ -1606,6 +1611,7 @@ void inline_leave_functions(int maxsize, int leavesize, int size, int ignore_run
                        /* this irg got calls inlined */
                        set_irg_outs_inconsistent(irg);
                        set_irg_doms_inconsistent(irg);
+                       set_irg_loopinfo_inconsistent(irg);
 
                        optimize_graph_df(irg);
                        optimize_cf(irg);
@@ -1836,9 +1842,7 @@ void inline_functions(int inline_threshold) {
        const call_entry *centry;
        pmap             *copied_graphs;
        pmap_entry       *pm_entry;
-       DEBUG_ONLY(firm_dbg_module_t *dbg;)
 
-       FIRM_DBG_REGISTER(dbg, "firm.opt.inline");
        rem = current_ir_graph;
        obstack_init(&temp_obst);
 
@@ -1989,6 +1993,7 @@ void inline_functions(int inline_threshold) {
                        /* this irg got calls inlined */
                        set_irg_outs_inconsistent(irg);
                        set_irg_doms_inconsistent(irg);
+                       set_irg_loopinfo_inconsistent(irg);
 
                        if (env->local_vars)
                                scalar_replacement_opt(irg);
@@ -2016,3 +2021,7 @@ void inline_functions(int inline_threshold) {
        obstack_free(&temp_obst, NULL);
        current_ir_graph = rem;
 }
+
+void firm_init_inline(void) {
+       FIRM_DBG_REGISTER(dbg, "firm.opt.inline");
+}