New directory: ana for analyses. Adapted configure/makefiles
[libfirm] / ir / tr / mangle.c
index b13f303..2ac4532 100644 (file)
@@ -5,6 +5,8 @@
 **
 */
 
+/* $Id$ */
+
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
 # include "mangle.h"
 # include <obstack.h>
 # include "obst.h"
-# include "entity.h"
 # include <stdlib.h>
-# include "ident_t.h"
+# include "misc.h"
 
 /* Make types visible to allow most efficient access */
 # include "entity_t.h"
+# include "type_t.h"
+# include "tpop_t.h"
 
 static struct obstack mangle_obst;
 
@@ -45,9 +48,10 @@ mangle_type (type *type)
   int len;
   ident *res;
 
-  assert (type->kind == k_type_class);
+  assert (type->kind == k_type);
+  /* assert (type->type_op->code == tpo_class); */
 
-  xoprintf (&mangle_obst, "%I", type->clss.name);
+  xoprintf (&mangle_obst, "%I", type->name);
   len = obstack_object_size (&mangle_obst);
   cp = obstack_finish (&mangle_obst);
   res = id_from_str (cp, len);
@@ -55,6 +59,19 @@ mangle_type (type *type)
   return res;
 }
 
+/* Returns a new ident that represents first_scnd. */
+ident *mangle (ident *first, ident* scnd) {
+  char *cp;
+  int len;
+  ident *res;
+
+  xoprintf (&mangle_obst, "%I_%I",  first, scnd);
+  len = obstack_object_size (&mangle_obst);
+  cp = obstack_finish (&mangle_obst);
+  res = id_from_str (cp, len);
+  obstack_free (&mangle_obst, cp);
+  return res;
+}
 
 void
 init_mangle (void)