remove the unused 'ident' type, remove tpo_max add tpo_last
[libfirm] / ir / tr / typewalk.c
index fde9e46..f20857d 100644 (file)
@@ -22,7 +22,7 @@
  * @brief   Functionality to modify the type graph.
  * @author  Goetz Lindenmaier
  * @version $Id$
- * @summary
+ * @brief
  *
  * Traverse the type information.  The walker walks the whole ir graph
  * to find the distinct type trees in the type graph forest.
  */
 #include "config.h"
 
-#ifdef HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
-
+#include <stdlib.h>
 #include <stdio.h>
 
 #include "entity_t.h"
@@ -147,7 +144,6 @@ static void do_type_walk(type_or_ent tore,
        case k_type:
                mark_type_visited(tp);
                switch (get_type_tpop_code(tp)) {
-
                case tpo_class:
                        n_types = get_class_n_supertypes(tp);
                        for (i = 0; i < n_types; ++i) {
@@ -211,13 +207,13 @@ static void do_type_walk(type_or_ent tore,
                        do_type_walk(cont, pre, post, env);
                        break;
 
+               case tpo_code:
                case tpo_primitive:
-               case tpo_id:
                case tpo_none:
                case tpo_unknown:
                        /* a leave. */
                        break;
-               default:
+               case tpo_uninitialized:
                        assert(0 && "Faulty type");
                        break;
                }
@@ -279,6 +275,29 @@ void type_walk(type_walk_func *pre, type_walk_func *post, void *env) {
        do_type_walk(cont, pre, post, env);
 }
 
+void type_walk_prog(type_walk_func *pre, type_walk_func *post, void *env) {
+       int i, n_irgs = get_irp_n_irgs();
+       type_or_ent cont;
+
+       type_walk(pre, post, env);
+
+       for (i = 0; i < n_irgs; ++i) {
+               ir_graph *irg = get_irp_irg(i);
+               cont.typ = get_irg_frame_type(irg);
+               do_type_walk(cont, pre, post, env);
+
+               cont.typ = get_method_value_param_type(get_entity_type(get_irg_entity(irg)));
+               if(cont.typ)
+                       do_type_walk(cont, pre, post, env);
+       }
+
+       for (i = 0; i < IR_SEGMENT_COUNT; ++i) {
+               cont.typ = get_segment_type((ir_segment_t) i);
+               if(cont.typ)
+                       do_type_walk(cont, pre, post, env);
+       }
+}
+
 void type_walk_irg(ir_graph *irg,
                    type_walk_func *pre,
                    type_walk_func *post,
@@ -379,7 +398,6 @@ static void type_walk_s2s_2(type_or_ent tore,
                        case tpo_enumeration:
                        case tpo_pointer:
                        case tpo_primitive:
-                       case tpo_id:
                                /* dont care */
                                break;
                        default:
@@ -473,7 +491,6 @@ type_walk_super_2(type_or_ent tore,
                        case tpo_enumeration:
                        case tpo_pointer:
                        case tpo_primitive:
-                       case tpo_id:
                                /* don't care */
                                break;
                        default:
@@ -594,7 +611,6 @@ void walk_types_entities(ir_type *tp,
        case tpo_enumeration:
        case tpo_pointer:
        case tpo_primitive:
-       case tpo_id:
        default:
                break;
        }