Fixed debug info for defaultProj
[libfirm] / ir / external / read.c
index be932e8..95b01be 100644 (file)
@@ -1,32 +1,33 @@
-/* -*- c -*- */
-
 /*
- * Project:     libFIRM
- * File name:   ir/external/read.c
- * Purpose:     Read descriptions of external effects
- * Author:      Florian
- * Modified by: Boris Boesler
- * Created:     11.10.2004
- * CVS-ID:      $Id$
- * Copyright:   (c) 1999-2004 Universität Karlsruhe
- * Licence:     This file is protected by GPL -  GNU GENERAL PUBLIC LICENSE.
+ * Copyright (C) 1995-2008 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.
  */
 
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-/* get prototype for alloca somehow */
-#ifdef HAVE_ALLOCA_H
-# include <alloca.h>
-#endif
-#ifdef HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
-#ifdef HAVE_STRING_H
-# include <string.h>
-#endif
+/**
+ * @file
+ * @brief     Read descriptions of external effects
+ * @author    Florian, Boris Boesler
+ * @date      11.10.2004
+ * @version   $Id$
+ */
+#include "config.h"
 
+#include <stdlib.h>
+#include <string.h>
 #include <assert.h>
 
 #include <libxml/xmlmemory.h>
@@ -42,7 +43,7 @@
 #include "irmode.h"
 #include "irdump.h"
 #include "irvrfy.h"
-#include "type.h"
+#include "typerep.h"
 #include "tv.h"
 #include "xmalloc.h"
 
@@ -53,8 +54,6 @@
 # define NODE_NAME(n, m) (0 == xmlStrcmp (n->name, (const xmlChar*) #m))
 # define CHECK_NAME(n, m) assert (0 == xmlStrcmp (n->name, (const xmlChar*) #m))
 
-# define NEW(T)     (T*)xmalloc(sizeof (T))
-
 
 #define VERBOSE_PRINTING 0
 
@@ -91,7 +90,7 @@ static const char *effect_string[] = {
 };
 #endif /* defined VERBOSE_PRINTING */
 
-static const ident*
+static ident*
 getNodeModuleIdent (xmlNodePtr node)
 {
   const char *mod_str = (const char*) xmlGetProp (node, BAD_CAST "module");
@@ -99,7 +98,7 @@ getNodeModuleIdent (xmlNodePtr node)
   if (NULL == mod_str) {
     return (NULL);
   } else {
-    const ident *res = new_id_from_str (mod_str);
+    ident *res = new_id_from_str (mod_str);
     return (res);
   }
 }
@@ -165,7 +164,7 @@ getNodeOwnerStr (xmlNodePtr node)
 static const char
 *getNodeEntityStr (xmlNodePtr node)
 {
-  const char *ent_str = (char*) xmlGetProp (node, BAD_CAST "entity");
+  const char *ent_str = (char*) xmlGetProp (node, BAD_CAST "ir_entity");
   assert (ent_str);
 
   return (ent_str);
@@ -177,7 +176,7 @@ static const char
 */
 # ifdef NEEDED
 static
-type_t *getTypeByIdent (const ident *id)
+type_t *getTypeByIdent (ident *id)
 {
   type_t *curr = types; // @@@ TODO module -> types
 
@@ -194,7 +193,7 @@ type_t *getTypeByIdent (const ident *id)
 
 # ifdef NEEDED
 static
-type_t *getTypeById (const ident *id)
+type_t *getTypeById (ident *id)
 {
   type_t *curr = types; // which ones?
 
@@ -211,7 +210,7 @@ type_t *getTypeById (const ident *id)
 
 # ifdef NEEDED
 static
-entity_t *getEntityByIdents (const ident *name, const ident *tp_ident)
+entity_t *getEntityByIdents (ident *name, ident *tp_ident)
 {
   entity_t *curr = entities; // TODO module -> entities
 
@@ -228,7 +227,7 @@ entity_t *getEntityByIdents (const ident *name, const ident *tp_ident)
 # endif /* defined NEEDED */
 
 static
-entity_t *getEntityById (const ident *id)
+entity_t *getEntityById (ident *id)
 {
   entity_t *curr = entities;
 
@@ -244,7 +243,7 @@ entity_t *getEntityById (const ident *id)
 
 # ifdef NEEDED
 static
-proc_t *getEffectByName (const ident *proc_ident)
+proc_t *getEffectByName (ident *proc_ident)
 {
   proc_t *curr_effs = procs;
 
@@ -293,6 +292,7 @@ parseArg (xmlDocPtr doc, xmlNodePtr argelm)
   int num;
   char *num_str;
   eff_t *arg;
+  (void) doc;
 
   CHECK_NAME (argelm, arg);
   VERBOSE_PRINT ((stdout, "arg node \t0x%08x\n", (int) argelm));
@@ -305,7 +305,7 @@ parseArg (xmlDocPtr doc, xmlNodePtr argelm)
 
   typeid = getNodeTypeStr (argelm);
 
-  arg = NEW (eff_t);
+  arg = XMALLOC(eff_t);
   arg -> kind = eff_arg;
   arg -> id = new_id_from_str(id);
   arg -> effect.arg.num = num;
@@ -319,6 +319,7 @@ parseValref (xmlDocPtr doc, xmlNodePtr valelm)
 {
   const char *ref_id;
   eff_t *valref;
+  (void) doc;
 
   CHECK_NAME (valelm, valref);
   VERBOSE_PRINT ((stdout, "valref node \t0x%08x\n", (int) valelm));
@@ -326,7 +327,7 @@ parseValref (xmlDocPtr doc, xmlNodePtr valelm)
   ref_id = getNodeRefId (valelm);
   VERBOSE_PRINT ((stdout, "val->refid = \"%s\"\n", ref_id));
 
-  valref = NEW (eff_t);
+  valref = XMALLOC(eff_t);
   valref->kind = eff_valref;
   valref-> id = new_id_from_str(ref_id);
 
@@ -336,19 +337,19 @@ parseValref (xmlDocPtr doc, xmlNodePtr valelm)
 static eff_t*
 parseSelect (xmlDocPtr doc, xmlNodePtr selelm)
 {
-  const ident *entity_id = new_id_from_str(getNodeEntityStr (selelm));
+  ident *entity_id = new_id_from_str(getNodeEntityStr (selelm));
   entity_t *ent;
   xmlNodePtr child;
   eff_t *valref = NULL;
-  eff_t *sel = NEW (eff_t);
+  eff_t *sel = XMALLOC(eff_t);
   sel->kind = eff_select;
 
   CHECK_NAME (selelm, select);
   VERBOSE_PRINT ((stdout, "select node \t0x%08x\n", (int) selelm));
 
   ent = getEntityById (entity_id);
-  assert(ent && "entity not found");
-  VERBOSE_PRINT ((stdout, "select entity %s\n", get_id_str(ent -> ent_ident)));
+  assert(ent && "ir_entity not found");
+  VERBOSE_PRINT ((stdout, "select ir_entity %s\n", get_id_str(ent -> ent_ident)));
 
   child = selelm->xmlChildrenNode;
 
@@ -369,10 +370,10 @@ parseSelect (xmlDocPtr doc, xmlNodePtr selelm)
 static eff_t*
 parseLoad (xmlDocPtr doc, xmlNodePtr loadelm)
 {
-  const ident *id;
+  ident *id;
   xmlNodePtr child;
   eff_t *sel;
-  eff_t *load = NEW (eff_t);
+  eff_t *load = XMALLOC(eff_t);
   load->kind = eff_load;
 
   CHECK_NAME (loadelm, load);
@@ -383,7 +384,7 @@ parseLoad (xmlDocPtr doc, xmlNodePtr loadelm)
   if(NODE_NAME (child, select)) {
     sel = parseSelect (doc, child);
     load-> effect.load.ent = sel-> effect.select.ent;
-    VERBOSE_PRINT ((stdout, "load entity \t%s\n",
+    VERBOSE_PRINT ((stdout, "load ir_entity \t%s\n",
             get_id_str(load -> effect.load.ent -> ent_ident)));
   }
   else {
@@ -405,7 +406,7 @@ parseStore (xmlDocPtr doc, xmlNodePtr storeelm)
   xmlNodePtr child;
   eff_t *sel;
   eff_t *valref;
-  eff_t *store = NEW (eff_t);
+  eff_t *store = XMALLOC(eff_t);
   store->kind = eff_store;
 
   CHECK_NAME (storeelm, store);
@@ -436,10 +437,11 @@ parseStore (xmlDocPtr doc, xmlNodePtr storeelm)
 static eff_t*
 parseAlloc (xmlDocPtr doc, xmlNodePtr allocelm)
 {
-  const ident *id;
-  const ident *type_id;
-  eff_t *alloc = NEW (eff_t); /* ...! */
+  ident *id;
+  ident *type_id;
+  eff_t *alloc = XMALLOC(eff_t); /* ...! */
   alloc->kind = eff_alloc;
+  (void) doc;
 
   CHECK_NAME (allocelm, alloc);
   VERBOSE_PRINT ((stdout, "alloc node \t0x%08x\n", (int) allocelm));
@@ -457,12 +459,12 @@ parseAlloc (xmlDocPtr doc, xmlNodePtr allocelm)
 static eff_t*
 parseCall (xmlDocPtr doc, xmlNodePtr callelm)
 {
-  const ident *id;
+  ident *id;
   xmlNodePtr child;
   eff_t *sel;
   xmlNodePtr arg;
   int n_args;
-  eff_t *call = NEW (eff_t);
+  eff_t *call = XMALLOC(eff_t);
   call->kind = eff_call;
 
   CHECK_NAME (callelm, call);
@@ -496,7 +498,7 @@ parseCall (xmlDocPtr doc, xmlNodePtr callelm)
   free (sel);
 
   if (0 != n_args) {
-    const ident **args = (const ident**) xmalloc(n_args * sizeof(const ident*));
+    ident **args = XMALLOCN(ident*, n_args);
     int i = 0;
 
     while (NULL != arg) {
@@ -515,12 +517,12 @@ parseCall (xmlDocPtr doc, xmlNodePtr callelm)
 static eff_t*
 parseJoin (xmlDocPtr doc, xmlNodePtr joinelm)
 {
-  const ident *id;
+  ident *id;
   int n_ins;
-  const ident **ins;
+  ident **ins;
   int i;
   xmlNodePtr child;
-  eff_t *join = NEW (eff_t);
+  eff_t *join = XMALLOC(eff_t);
   join->kind = eff_join;
 
   CHECK_NAME (joinelm, join);
@@ -536,7 +538,7 @@ parseJoin (xmlDocPtr doc, xmlNodePtr joinelm)
     child = child->next;
   }
 
-  ins = (const ident **) xmalloc (n_ins * sizeof (const ident *) );
+  ins = XMALLOCN(ident*, n_ins);
   i = 0;
   child = get_valid_child(joinelm);
 
@@ -557,9 +559,10 @@ parseJoin (xmlDocPtr doc, xmlNodePtr joinelm)
 static eff_t*
 parseUnknown (xmlDocPtr doc, xmlNodePtr unknownelm)
 {
-  const ident *id;
-  eff_t *unknown = NEW (eff_t);
+  ident *id;
+  eff_t *unknown = XMALLOC(eff_t);
   unknown->kind = eff_unknown;
+  (void) doc;
 
   CHECK_NAME (unknownelm, unknown);
   VERBOSE_PRINT ((stdout, "unknown node \t0x%08x\n", (int) unknownelm));
@@ -573,7 +576,7 @@ static eff_t*
 parseReturn (xmlDocPtr doc, xmlNodePtr retelm)
 {
   xmlNodePtr child;
-  eff_t *ret = NEW (eff_t);
+  eff_t *ret = XMALLOC(eff_t);
   ret->kind = eff_ret;
 
   CHECK_NAME (retelm, ret);
@@ -598,7 +601,7 @@ parseRaise (xmlDocPtr doc, xmlNodePtr raiseelm)
   const char *tp_id;
   eff_t *valref;
   xmlNodePtr child;
-  eff_t *raise = NEW (eff_t);
+  eff_t *raise = XMALLOC(eff_t);
   raise->kind = eff_raise;
 
   CHECK_NAME (raiseelm, raise);
@@ -630,8 +633,9 @@ parseType (xmlDocPtr doc, xmlNodePtr typeelm)
   const char *tp_id = getNodeId (typeelm);
   VERBOSE_PRINT ((stdout, "type node \t0x%08x (%s)\n", (int) typeelm, tp_id));
   VERBOSE_PRINT ((stdout, "type = \"%s\"\n", getNodeTypeStr (typeelm)));
+  (void) doc;
 
-  type = (type_t*) xmalloc (sizeof (type_t));
+  type = XMALLOC(type_t);
   type -> type_ident = new_id_from_str(getNodeTypeStr (typeelm));
   type -> id         = new_id_from_str(tp_id);
 
@@ -639,15 +643,16 @@ parseType (xmlDocPtr doc, xmlNodePtr typeelm)
   types = type;
 }
 
-/** parse an entity node and insert it into the list */
+/** parse an ir_entity node and insert it into the list */
 static void
 parseEntity (xmlDocPtr doc, xmlNodePtr entelm)
 {
-  entity_t *ent = NEW (entity_t);
+  entity_t *ent = XMALLOC(entity_t);
+  (void) doc;
 
   /* parse it */
   const char *ent_id = getNodeId (entelm);
-  /* fprintf (stdout, "entity node \t0x%08x (%d)\n", (int) entelm, ent_id); */
+  /* fprintf (stdout, "ir_entity node \t0x%08x (%d)\n", (int) entelm, ent_id); */
   VERBOSE_PRINT ((stdout, "ent  = \"%s.%s\"\n",
           getNodeTypeStr (entelm),
           getNodeEntityStr (entelm)));
@@ -682,10 +687,10 @@ parseEffect (xmlDocPtr doc, xmlNodePtr effelm)
   }
   VERBOSE_PRINT ((stdout, "has %d effects\n", n_effs));
 
-  curr_effs = NEW (proc_t);
+  curr_effs = XMALLOC(proc_t);
   curr_effs -> proc_ident = new_id_from_str(procname);
   curr_effs -> ownerid = new_id_from_str(ownerid);
-  curr_effs->effs = (eff_t**) xmalloc (n_effs * sizeof (eff_t*));
+  curr_effs->effs = XMALLOCN(eff_t*, n_effs);
 
   cur = effelm -> xmlChildrenNode;
   while (NULL != cur) {
@@ -769,7 +774,7 @@ int read_extern (const char *filename)
   while (cur != NULL) {
     if (NODE_NAME (cur, type)) {
       parseType (doc, cur);
-    } else if (NODE_NAME (cur, entity)) {
+    } else if (NODE_NAME (cur, ir_entity)) {
       parseEntity (doc, cur);
     } else if (NODE_NAME (cur, effect)) {
       parseEffect (doc, cur);
@@ -782,7 +787,7 @@ int read_extern (const char *filename)
     cur = cur->next;
   }
 
-  module = NEW(module_t);
+  module = XMALLOC(module_t);
   module -> id = mod_id;
   module -> types = types;
   module -> entities = entities;
@@ -808,7 +813,6 @@ void freeArg (eff_t *arg)
 {
   VERBOSE_PRINT ((stdout, "free arg node \t0x%08x\n", (int) arg));
   free(arg);
-  return;
 }
 
 static
@@ -816,7 +820,6 @@ void freeValref (eff_t *valref)
 {
   VERBOSE_PRINT ((stdout, "free valref node \t0x%08x\n", (int) valref));
   free(valref);
-  return;
 }
 
 static
@@ -824,7 +827,6 @@ void freeSelect (eff_t *sel)
 {
   VERBOSE_PRINT ((stdout, "free select node \t0x%08x\n", (int) sel));
   free(sel);
-  return;
 }
 
 static
@@ -832,7 +834,6 @@ void freeLoad (eff_t *load)
 {
   VERBOSE_PRINT ((stdout, "free load node \t0x%08x\n", (int) load));
   free (load);
-  return;
 }
 
 static
@@ -840,7 +841,6 @@ void freeStore (eff_t *store)
 {
   VERBOSE_PRINT ((stdout, "free store node \t0x%08x\n", (int) store));
   free (store);
-  return;
 }
 
 static
@@ -848,7 +848,6 @@ void freeAlloc (eff_t *alloc)
 {
   VERBOSE_PRINT ((stdout, "free alloc node \t0x%08x\n", (int) alloc));
   free(alloc);
-  return;
 }
 
 static
@@ -857,7 +856,6 @@ void freeCall (eff_t *call)
   VERBOSE_PRINT ((stdout, "free call node \t0x%08x\n", (int) call));
   free(call -> effect.call.args);
   free(call);
-  return;
 }
 
 static
@@ -866,7 +864,6 @@ void freeJoin (eff_t *join)
   VERBOSE_PRINT ((stdout, "free join node \t0x%08x\n", (int) join));
   free(join -> effect.join.ins);
   free(join);
-  return;
 }
 
 static
@@ -874,7 +871,6 @@ void freeUnknown (eff_t *unknown)
 {
   VERBOSE_PRINT ((stdout, "free unknown node \t0x%08x\n", (int) unknown));
   free(unknown);
-  return;
 }
 
 static
@@ -882,7 +878,6 @@ void freeReturn (eff_t *ret)
 {
   VERBOSE_PRINT ((stdout, "free ret node \t0x%08x\n", (int) ret));
   free(ret);
-  return;
 }
 
 static
@@ -890,7 +885,6 @@ void freeRaise (eff_t *raise)
 {
   VERBOSE_PRINT ((stdout, "free raise node \t0x%08x\n", (int) raise));
   free (raise);
-  return;
 }
 
 
@@ -982,7 +976,7 @@ void free_data(void)
 /********************************************************************/
 
 static
-type_t *find_type_in_module(module_t *module, const ident *typeid)
+type_t *find_type_in_module(module_t *module, ident *typeid)
 {
   type_t *type;
 
@@ -1006,7 +1000,7 @@ static void add_value_to_proc(proc_t *proc, eff_t *eff)
 }
 
 
-eff_t *find_valueid_in_proc_effects(const ident *id, proc_t *proc)
+eff_t *find_valueid_in_proc_effects(ident *id, proc_t *proc)
 {
   eff_t *val;
 
@@ -1055,9 +1049,9 @@ static void create_abstract_return(ir_graph *irg, proc_t *proc, eff_t *eff)
 static void create_abstract_arg(ir_graph *irg, proc_t *proc, eff_t *eff)
 {
   ir_node *arg;
-  entity *ent;
+  ir_entity *ent;
   ir_mode *mode;
-  type *typ;
+  ir_type *typ;
   int num;
 
   VERBOSE_PRINT((stdout, "create effect:arg %d in %s\n",
@@ -1081,9 +1075,10 @@ static void create_abstract_arg(ir_graph *irg, proc_t *proc, eff_t *eff)
 static void create_abstract_load(ir_graph *irg, proc_t *proc, eff_t *eff)
 {
   ir_node *sel, *load;
-  entity *ent;
+  ir_entity *ent;
   ir_mode *mode;
   eff_t *addr;
+  (void) irg;
 
   VERBOSE_PRINT((stdout, "create load in %s\n",
          get_id_str(proc -> proc_ident)));
@@ -1112,7 +1107,7 @@ static void create_abstract_load(ir_graph *irg, proc_t *proc, eff_t *eff)
     sel = addr -> firmnode;
     mode = mode_ANY;
   }
-  load = new_Load(get_store(), sel, mode);
+  load = new_Load(get_store(), sel, mode, 0);
   set_store(new_Proj(load, mode_M, 0));
   eff -> firmnode = new_Proj(load, mode, 2);
 
@@ -1123,15 +1118,16 @@ static void create_abstract_load(ir_graph *irg, proc_t *proc, eff_t *eff)
 static void create_abstract_store(ir_graph *irg, proc_t *proc, eff_t *eff)
 {
   ir_node *sel, *store;
-  entity *ent;
+  ir_entity *ent;
   eff_t *addr, *val;
+  (void) irg;
 
   VERBOSE_PRINT((stdout, "create store in %s\n",
          get_id_str(proc -> proc_ident)));
 
   if(eff -> effect.store.ent) {
     ent = eff -> effect.store.ent -> f_ent;
-    VERBOSE_PRINT((stdout, "store to entity %s\n", get_entity_name(ent)));
+    VERBOSE_PRINT((stdout, "store to ir_entity %s\n", get_entity_name(ent)));
   }
   else {
     VERBOSE_PRINT((stdout, "store to memory\n"));
@@ -1158,7 +1154,7 @@ static void create_abstract_store(ir_graph *irg, proc_t *proc, eff_t *eff)
   else {
     sel = addr -> firmnode;
   }
-  store = new_Store(get_store(), sel, val -> firmnode);
+  store = new_Store(get_store(), sel, val -> firmnode, 0);
   set_store(new_Proj(store, mode_M, 0));
   eff -> firmnode = store;
 }
@@ -1166,10 +1162,11 @@ static void create_abstract_store(ir_graph *irg, proc_t *proc, eff_t *eff)
 
 static void create_abstract_alloc(ir_graph *irg, proc_t *proc, eff_t *eff)
 {
-  type *ftype;
+  ir_type *ftype;
   ir_node *alloc;
   type_t *xtype;
   symconst_symbol sym;
+  (void) irg;
 
   VERBOSE_PRINT((stdout, "create alloc in %s\n",
          get_id_str(proc -> proc_ident)));
@@ -1179,7 +1176,7 @@ static void create_abstract_alloc(ir_graph *irg, proc_t *proc, eff_t *eff)
   ftype = xtype -> f_tp;
 
   sym.type_p = ftype;
-  alloc = new_Alloc(get_store(), new_SymConst(sym, symconst_size), ftype,
+  alloc = new_Alloc(get_store(), new_SymConst(mode_Is, sym, symconst_type_size), ftype,
             heap_alloc);
   set_store(new_Proj(alloc, mode_M, 0));
   eff -> firmnode = new_Proj(alloc, mode_P, 2);
@@ -1191,6 +1188,7 @@ static void create_abstract_alloc(ir_graph *irg, proc_t *proc, eff_t *eff)
 static void create_abstract_unknown(ir_graph *irg, proc_t *proc, eff_t *eff)
 {
   ir_node *unknown;
+  (void) irg;
 
   VERBOSE_PRINT((stdout, "create unknown in %s\n",
          get_id_str(proc -> proc_ident)));
@@ -1205,12 +1203,13 @@ static void create_abstract_unknown(ir_graph *irg, proc_t *proc, eff_t *eff)
 static void create_abstract_call(ir_graph *irg, proc_t *proc, eff_t *eff)
 {
   ir_node *sel, *call;
-  entity *ent;
+  ir_entity *ent;
   eff_t *addr;
   ir_node **irns;
   int i, num;
-  type *mtype;
+  ir_type *mtype;
   int mik; /* is method somehow known? */
+  (void) irg;
 
   VERBOSE_PRINT((stdout, "create call in %s\n",
          get_id_str(proc -> proc_ident)));
@@ -1253,7 +1252,7 @@ static void create_abstract_call(ir_graph *irg, proc_t *proc, eff_t *eff)
     VERBOSE_PRINT((stdout, "number of args expected: %d\n",
            get_method_n_params(mtype)));
   }
-  irns = alloca(num * sizeof(ir_node*));
+  irns = ALLOCAN(ir_node*, num);
   for(i = 0; i < num; i++) {
     irns[i] = find_valueid_in_proc_effects(eff -> effect.call.args[i], proc)
       -> firmnode;
@@ -1290,6 +1289,7 @@ static void create_abstract_join (ir_graph *irg, proc_t *proc, eff_t *eff)
   ir_mode *join_md = mode_ANY;
   int n_ins = -1;
   int i;
+  (void) irg;
 
   VERBOSE_PRINT((stdout, "create join in %s\n",
          get_id_str(proc -> proc_ident)));
@@ -1308,8 +1308,9 @@ static void create_abstract_join (ir_graph *irg, proc_t *proc, eff_t *eff)
   cond    = new_Cond (unknown);
 
   c_block   = new_immBlock ();  /* for the Phi after the branch(es) */
+  set_cur_block(c_block);
 
-  ins = (ir_node**) xmalloc (n_ins * sizeof (ir_node*));
+  ins = XMALLOCN(ir_node*, n_ins);
   for (i = 0; i < n_ins; i ++) {
     ir_node *projX   = NULL;
     ir_node *s_block = NULL;
@@ -1322,6 +1323,7 @@ static void create_abstract_join (ir_graph *irg, proc_t *proc, eff_t *eff)
 
     /* this also sets current_block, so the rest of the code ends up there: */
     s_block = new_immBlock ();
+    set_cur_block(s_block);
 
     add_immBlock_pred (s_block, projX);
     mature_immBlock (s_block);
@@ -1344,7 +1346,6 @@ static void create_abstract_join (ir_graph *irg, proc_t *proc, eff_t *eff)
   phi = new_Phi (n_ins, ins, join_md);
 
   mature_immBlock (c_block);
-  memset (ins, 0x00, n_ins * sizeof (ir_node*));
   free (ins);
 
   eff->firmnode = phi;
@@ -1374,6 +1375,7 @@ static void create_abstract_raise (ir_graph *irg, proc_t *proc, eff_t *eff)
     ir_node *thrw  = NULL;
     eff_t *thrw_eff = NULL;
 
+       set_cur_block(b_exc);
     add_immBlock_pred (b_exc, projX);
 
     thrw_eff = find_valueid_in_proc_effects (eff->effect.raise.valref, proc);
@@ -1391,26 +1393,29 @@ static void create_abstract_raise (ir_graph *irg, proc_t *proc, eff_t *eff)
 
   /* one branch for 'non-exception' case */
   {
+       ir_node *block;
     ir_node *projX = new_Proj (cond, mode_X, 0);
-    new_immBlock ();            /* also sets current_block */
-    add_immBlock_pred (get_cur_block (), projX);
-    mature_immBlock (get_cur_block ());
+    block = new_immBlock ();
+    set_cur_block(block);
+    add_immBlock_pred (block, projX);
+    mature_immBlock (block);
     /* continue building in current_block */
   }
 
 }
 
-static void create_abstract_firm(module_t *module, proc_t *proc, entity *fent)
+static void create_abstract_firm(module_t *module, proc_t *proc, ir_entity *fent)
 {
   eff_t *eff;
   ir_graph *irg;
   int i, num;
+  (void) module;
 
-  /* test entity */
+  /* test ir_entity */
   assert(visibility_external_allocated == get_entity_visibility(fent)
      && peculiarity_existent == get_entity_peculiarity(fent)
-     && "not an abstract entity");
-  /* create irg in entity */
+     && "not an abstract ir_entity");
+  /* create irg in ir_entity */
   irg = new_pseudo_ir_graph(fent, 0);
   set_irg_inline_property(irg, irg_inline_forbidden);
 
@@ -1460,7 +1465,7 @@ static void create_abstract_firm(module_t *module, proc_t *proc, entity *fent)
     }
   }
 
-  /* close irg in entity */
+  /* close irg in ir_entity */
   /* Now we can mature the end block as all it's predecessors are known. */
   mature_immBlock (get_irg_end_block(irg));
 
@@ -1477,10 +1482,10 @@ static void assign_firm_entity(module_t *module, entity_t *xmlent)
 {
   int i, num;
   type_t *typ;
-  type *type;
-  entity *ent;
+  ir_type *type;
+  ir_entity *ent;
 
-  VERBOSE_PRINT((stdout, "assign entity %s to typeid %s\n",
+  VERBOSE_PRINT((stdout, "assign ir_entity %s to typeid %s\n",
          get_id_str(xmlent -> ent_ident),
          get_id_str(xmlent -> owner)));
 
@@ -1493,7 +1498,7 @@ static void assign_firm_entity(module_t *module, entity_t *xmlent)
   ent = NULL;
   for(i = 0; i < num; i++) {
     ent = get_class_member(type, i);
-    VERBOSE_PRINT((stdout, "compare entity %s and %s\n",
+    VERBOSE_PRINT((stdout, "compare ir_entity %s and %s\n",
            get_id_str(xmlent -> ent_ident), get_entity_name(ent)));
 
     if(get_entity_ident(ent) == xmlent -> ent_ident) {
@@ -1501,7 +1506,7 @@ static void assign_firm_entity(module_t *module, entity_t *xmlent)
     }
     ent = NULL;
   }
-  assert(ent && "did not find a entity");
+  assert(ent && "did not find a ir_entity");
 
   xmlent -> f_ent = ent;
 }
@@ -1511,7 +1516,7 @@ static void assign_firm_entity(module_t *module, entity_t *xmlent)
 static void assign_firm_type(type_t *xmltype)
 {
   int i;
-  type *typ = NULL;
+  ir_type *typ = NULL;
   int num;
 
   VERBOSE_PRINT((stdout, "assign firm type to type %s\n",
@@ -1544,9 +1549,9 @@ static
 void create_abstract_proc_effect(module_t *module, proc_t *proc)
 {
   int i, num;
-  type *class_typ = NULL;
+  ir_type *class_typ = NULL;
   type_t *type;
-  entity *fent;
+  ir_entity *fent;
 
   /* find the class of a procedure */
   VERBOSE_PRINT((stdout, "do find owner id %s\n", get_id_str(proc -> ownerid)));
@@ -1577,7 +1582,7 @@ void create_abstract_proc_effect(module_t *module, proc_t *proc)
   assert(is_Class_type(class_typ) && "is not a class type");
   type -> f_tp = class_typ;
 
-  /* find entity for procedure in class */
+  /* find ir_entity for procedure in class */
   VERBOSE_PRINT((stdout, "find method %s\n",
          get_id_str(proc -> proc_ident)));
 
@@ -1683,8 +1688,17 @@ void free_abstraction(void) {
 \f
 /*
  * $Log$
- * Revision 1.23  2005/11/18 09:46:50  beck
- * removed depency of bool type and stdbool.h (not C89)
+ * Revision 1.27  2007/02/02 12:38:35  matze
+ * entity is ir_entity now
+ *
+ * Revision 1.26  2006/12/15 12:37:40  matze
+ * fix warnings
+ *
+ * Revision 1.25  2006/06/09 11:26:35  firm
+ * renamed type to ir_type
+ *
+ * Revision 1.24  2006/05/29 13:34:49  beck
+ * renamed symconst_size to symconst_type_size
  *
  * Revision 1.22  2005/08/16 10:18:35  beck
  * create_abstraction() now returns an error code if the file could not