removed unused header
[libfirm] / ir / opt / proc_cloning.c
index c4fc925..800cc64 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/proc_cloning.c
@@ -6,7 +25,6 @@
  * Created:
  * CVS-ID:      $Id$
  * Copyright:   (c) 1998-2005 Universität Karlsruhe
- * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
  */
 
 /**
 #include "config.h"
 #endif
 
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
 #ifdef HAVE_STRING_H
 #include <string.h>
 #endif
@@ -50,6 +62,7 @@
 #include "irtools.h"
 #include "irgmod.h"
 #include "array.h"
+#include "xmalloc.h"
 
 /* A macro to iterate sets.*/
 #define ITERATE_SET(set_entries, entry) for(entry = set_first(set_entries); entry; entry = set_next(set_entries))
  * decide if this function must be cloned.
  */
 typedef struct quadruple {
-  entity          *ent;     /**< The entity of our Call. */
+  ir_entity       *ent;     /**< The entity of our Call. */
   int             pos;      /**< Position of a constant argument of our Call. */
   tarval          *tv;      /**< The tarval of this argument if Const node. */
   ir_node         **calls;  /**< The list of all calls with the same characteristics */
-} quad_t;
+} quadruple_t;
 
 /**
  * The quadruplets are hold in a sorted list
  */
 typedef struct entry {
-  quad_t       q;      /**< the quadruple */
+  quadruple_t       q;      /**< the quadruple */
   float        weight; /**< its weight */
   struct entry *next;  /**< link to the next one */
 } entry_t;
@@ -120,7 +133,7 @@ static void kill_entry(entry_t *entry) {
  * @param callee  The entity of the callee
  * @param hmap    The quadruple-set containing the calls with constant parameters
  */
-static void process_call(ir_node *call, entity *callee, q_set *hmap)
+static void process_call(ir_node *call, ir_entity *callee, q_set *hmap)
 {
   ir_type *mtp;
   entry_t *key, *entry;
@@ -184,7 +197,7 @@ static void collect_irg_calls(ir_node *call, void *env)
 {
   q_set *hmap = env;
   ir_node *call_ptr;
-  entity *callee;
+  ir_entity *callee;
 
   /* We collect just "Call" nodes */
   if (is_Call(call)) {
@@ -345,7 +358,7 @@ static ir_node *get_irg_arg(ir_graph *irg, int pos)
  * @param ent The entity of the method that must be cloned.
  * @param q   Our quadruplet.
  */
-static void create_clone_proc_irg(entity *ent, quad_t *q)
+static void create_clone_proc_irg(ir_entity *ent, quadruple_t *q)
 {
   ir_graph *method_irg, *clone_irg;
   ir_node *arg, *const_arg;
@@ -384,7 +397,7 @@ static void create_clone_proc_irg(entity *ent, quad_t *q)
  * @param ent The entity of the clone.
  * @param nr  A pointer to the counter of clones.
  **/
-static void change_entity_type(quad_t *q, entity *ent, unsigned *nr)
+static void change_entity_type(quadruple_t *q, ir_entity *ent, unsigned *nr)
 {
   ir_type *mtp, *new_mtp, *tp;
   ident   *tp_name;
@@ -422,9 +435,9 @@ static void change_entity_type(quad_t *q, entity *ent, unsigned *nr)
  *
  * @param q   Contains information for the method to clone.
  */
-static entity *clone_method(quad_t *q)
+static ir_entity *clone_method(quadruple_t *q)
 {
-  entity *new_entity;
+  ir_entity *new_entity;
   ident *clone_ident;
   ir_graph *rem;
   symconst_symbol sym;
@@ -469,7 +482,7 @@ static entity *clone_method(quad_t *q)
  * @param new_entity  The entity of the cloned function.
  * @param pos         The position of the replaced parameter of this call.
  **/
-static ir_node *new_cl_Call(ir_node *call, entity *new_entity, int pos)
+static ir_node *new_cl_Call(ir_node *call, ir_entity *new_entity, int pos)
 {
   ir_node **in;
   ir_type *mtp;
@@ -504,7 +517,7 @@ static ir_node *new_cl_Call(ir_node *call, entity *new_entity, int pos)
  * @param cloned_ent    The entity of the new function that must be called
  *                      from the new Call.
  */
-static void exchange_calls(quad_t *q, entity *cloned_ent)
+static void exchange_calls(quadruple_t *q, ir_entity *cloned_ent)
 {
   int pos = q->pos;
   ir_node *new_call, *call;
@@ -540,7 +553,7 @@ static void reorder_weights(q_set *hmap, float threshold)
 {
   entry_t **adr, *p, *entry;
   int i, len;
-  entity *callee;
+  ir_entity *callee;
 
 restart:
   entry = hmap->heavy_uses;
@@ -682,7 +695,7 @@ void proc_cloning(float threshold)
 
     entry = hmap.heavy_uses;
     if (entry) {
-      entity *ent = clone_method(&entry->q);
+      ir_entity *ent = clone_method(&entry->q);
 
       hmap.heavy_uses = entry->next;