Restructure and improve
[libfirm] / ir / opt / escape_ana.c
index fca2f6f..fa1d52b 100644 (file)
@@ -48,7 +48,7 @@ typedef struct _walk_env {
 } walk_env_t;
 
 /** debug handle */
-firm_dbg_module_t *dbgHandle;
+DEBUG_ONLY(firm_dbg_module_t *dbgHandle;)
 
 /**
  * checks whether a Raise leaves a method
@@ -269,7 +269,7 @@ static void find_allocations(ir_node *alloc, void *ctx)
 static void transform_allocs(ir_graph *irg, walk_env_t *env)
 {
   ir_node *alloc, *next, *mem, *sel, *size;
-  type *ftp, *atp, *tp;
+  ir_type *ftp, *atp, *tp;
   entity *ent;
   char name[128];
   unsigned nr = 0;
@@ -297,7 +297,7 @@ static void transform_allocs(ir_graph *irg, walk_env_t *env)
     atp  = get_Alloc_type(alloc);
 
     tp = NULL;
-    if (get_irn_op(size) == op_SymConst && get_SymConst_kind(size) == symconst_size)  {
+    if (get_irn_op(size) == op_SymConst && get_SymConst_kind(size) == symconst_type_size)  {
       /* if the size is a type size and the types matched */
       assert(atp == get_SymConst_type(size));
       tp = atp;
@@ -349,8 +349,10 @@ static void transform_allocs(ir_graph *irg, walk_env_t *env)
   if (env->nr_removed | env->nr_deads) {
     set_irg_outs_inconsistent(irg);
 
-    if (env->nr_deads)
-      set_irg_dom_inconsistent(irg);
+    if (env->nr_deads) {
+      /* exception control flow might have been changed */
+      set_irg_doms_inconsistent(irg);
+    }
   }
 }
 
@@ -392,8 +394,7 @@ void escape_analysis(int run_scalar_replace)
     return;
   }
 
-  if (! dbgHandle)
-    dbgHandle = firm_dbg_register("firm.opt.escape_ana");
+  FIRM_DBG_REGISTER(dbgHandle, "firm.opt.escape_ana");
 
   /*
    * We treat memory for speed: we first collect all info in a