Loads do not remove any nodes from the exec after sets. Also fix a 'node leak'.
[libfirm] / ir / opt / escape_ana.c
index fca2f6f..d37ca7c 100644 (file)
@@ -1,3 +1,22 @@
+/*
+ * Copyright (C) 1995-2007 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.
+ */
+
 /*
  * Project:     libFIRM
  * File name:   ir/opt/escape_ana.c
@@ -7,7 +26,6 @@
  * Created:     03.11.2005
  * CVS-ID:      $Id$
  * Copyright:   (c) 1999-2005 Universität Karlsruhe
- * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
  */
 
 /**
@@ -48,7 +66,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
@@ -128,7 +146,7 @@ static int can_escape(ir_node *n) {
 
     case iro_Call: { /* most complicated case */
       ir_node *ptr = get_Call_ptr(succ);
-      entity *ent;
+      ir_entity *ent;
 
       if (get_irn_op(ptr) == op_SymConst &&
           get_SymConst_kind(ptr) == symconst_addr_ent) {
@@ -269,8 +287,8 @@ 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;
-  entity *ent;
+  ir_type *ftp, *atp, *tp;
+  ir_entity *ent;
   char name[128];
   unsigned nr = 0;
   dbg_info *dbg;
@@ -297,7 +315,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 +367,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 +412,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