Errors and Features of type_id stuff
[libfirm] / ir / ir / irprog.c
index f7355f2..963ae93 100644 (file)
@@ -6,9 +6,14 @@
 ** irprog.c: ir representation of a program
 */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 # include "irprog_t.h"
 # include "array.h"
 # include "obst.h"
+# include "typegmod.h"
 
 #define GLOBAL_TYPE_NAME "GlobalType"
 
@@ -56,9 +61,9 @@ void set_irp_main_irg(ir_graph *main_irg) {
   irp->main_irg = main_irg;
 }
 
-type_class *get_glob_type(void) {
+type *get_glob_type(void) {
   assert(irp);
-  return irp->glob_type;
+  return irp->glob_type = skip_tid(irp->glob_type);
 }
 
 /* Adds irg to the list of ir graphs in irp. */
@@ -103,8 +108,8 @@ int get_irp_n_types (void) {
 type *get_irp_type(int pos) {
   assert (irp && irp->types);
   /* Strangely the first element of the array is NULL.  Why??  */
-  return irp->types[pos+1];
-
+  /* Don't set the skip_tid result so that no double entries are generated. */
+  return skip_tid(irp->types[pos+1]);
 }
 
 void  set_irp_type(int pos, type *typ) {
@@ -112,7 +117,6 @@ void  set_irp_type(int pos, type *typ) {
   assert (pos < (ARR_LEN((irp)->types) - 1));
   /* Strangely the first element of the array is NULL.  Why??  */
   irp->types[pos+1] = typ;
-
 }
 
 #ifdef DEBUG_libfirm