Fixed the last fix again:
[libfirm] / ir / opt / scalar_replace.c
index 340ad66..1011145 100644 (file)
@@ -1,26 +1,32 @@
 /*
- * Project:     libFIRM
- * File name:   ir/opt/scalar_replace.c
- * Purpose:     scalar replacement of arrays and compounds
- * Author:      Beyhan Veliev
- * Modified by: Michael Beck
- * Created:
- * CVS-ID:      $Id$
- * Copyright:   (c) 1998-2005 Universität Karlsruhe
- * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
+ * 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.
+ */
+
+/**
+ * @file
+ * @brief   Scalar replacement of compounds.
+ * @author  Beyhan Veliev, Michael Beck
+ * @version $Id$
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-
 #ifdef HAVE_STRING_H
 #include <string.h>
 #endif
@@ -38,6 +44,7 @@
 #include "irgmod.h"
 #include "irnode_t.h"
 #include "irtools.h"
+#include "xmalloc.h"
 
 #define SET_VNUM(node, vnum) set_irn_link(node, INT_TO_PTR(vnum))
 #define GET_VNUM(node)       (unsigned)PTR_TO_INT(get_irn_link(node))
@@ -48,7 +55,7 @@
  * accesses like a.b.c[8].d
  */
 typedef union {
-  entity *ent;
+  ir_entity *ent;
   tarval *tv;
 } path_elem_t;
 
@@ -66,7 +73,7 @@ typedef struct _path_t {
 #define PATH_SIZE(p)  (sizeof(*(p)) + sizeof((p)->path[0]) * ((p)->path_len - 1))
 
 typedef struct _scalars_t {
-  entity *ent;                 /**< A entity for scalar replacement. */
+  ir_entity *ent;              /**< A entity for scalar replacement. */
   ir_type *ent_owner;          /**< The owner of this entity. */
 } scalars_t;
 
@@ -167,7 +174,7 @@ int is_address_taken(ir_node *sel)
   int     i;
   ir_mode *emode, *mode;
   ir_node *value;
-  entity  *ent;
+  ir_entity *ent;
 
   if (! is_const_sel(sel))
     return 1;
@@ -228,7 +235,7 @@ int is_address_taken(ir_node *sel)
  * @param ent  the entity that will be scalar replaced
  * @param sel  a Sel node that selects some fields of this entity
  */
-static void link_all_leave_sels(entity *ent, ir_node *sel)
+static void link_all_leave_sels(ir_entity *ent, ir_node *sel)
 {
   int i, n, flag = 1;
 
@@ -300,7 +307,7 @@ static int find_possible_replacements(ir_graph *irg)
     ir_node *succ = get_irn_out(irg_frame, i);
 
     if (is_Sel(succ)) {
-      entity *ent = get_Sel_entity(succ);
+      ir_entity *ent = get_Sel_entity(succ);
       set_entity_link(ent, NULL);
     }
   }
@@ -314,7 +321,7 @@ static int find_possible_replacements(ir_graph *irg)
     ir_node *succ = get_irn_out(irg_frame, i);
 
     if (is_Sel(succ)) {
-      entity *ent = get_Sel_entity(succ);
+      ir_entity *ent = get_Sel_entity(succ);
       ir_type *ent_type;
 
       if (get_entity_link(ent) == ADDRESS_TAKEN)
@@ -402,7 +409,7 @@ static path_t *find_path(ir_node *sel, unsigned len)
  *
  * @return the next free value number
  */
-static unsigned allocate_value_numbers(pset *sels, entity *ent, unsigned vnum, ir_mode ***modes)
+static unsigned allocate_value_numbers(pset *sels, ir_entity *ent, unsigned vnum, ir_mode ***modes)
 {
   ir_node *sel, *next;
   path_t *key, *path;
@@ -780,7 +787,7 @@ void scalar_replacement_opt(ir_graph *irg)
       ir_node *succ = get_irn_out(irg_frame, i);
 
       if (is_Sel(succ)) {
-        entity *ent = get_Sel_entity(succ);
+        ir_entity *ent = get_Sel_entity(succ);
 
         if (get_entity_link(ent) == NULL || get_entity_link(ent) == ADDRESS_TAKEN)
           continue;