remove commented out code
[libfirm] / ir / ana / trouts.c
index d03c04f..67c7abf 100644 (file)
@@ -25,7 +25,7 @@
  */
 #include "config.h"
 
-#include "trouts.h"
+#include "trouts_t.h"
 
 #include "array.h"
 #include "pmap.h"
@@ -53,12 +53,10 @@ static pmap *type_arraytype_map = NULL;
  */
 static ir_node **get_entity_access_array(const ir_entity *ent)
 {
-       ir_node **res;
        if (!entity_access_map) entity_access_map = pmap_create();
 
-       if (pmap_contains(entity_access_map, ent)) {
-               res = (ir_node **) pmap_get(entity_access_map, ent);
-       } else {
+       ir_node **res = pmap_get(ir_node*, entity_access_map, ent);
+       if (!res) {
                res = NEW_ARR_F(ir_node *, 0);
                pmap_insert(entity_access_map, ent, (void *)res);
        }
@@ -68,9 +66,7 @@ static ir_node **get_entity_access_array(const ir_entity *ent)
 
 static void set_entity_access_array(const ir_entity *ent, ir_node **accs)
 {
-       ir_node **old = (ir_node**)pmap_get(entity_access_map, ent);
-       if (old != accs)
-               pmap_insert(entity_access_map, ent, (void *)accs);
+       pmap_insert(entity_access_map, ent, (void *)accs);
 }
 
 /**
@@ -79,12 +75,10 @@ static void set_entity_access_array(const ir_entity *ent, ir_node **accs)
  */
 static ir_node **get_entity_reference_array(const ir_entity *ent)
 {
-       ir_node **res;
        if (!entity_reference_map) entity_reference_map = pmap_create();
 
-       if (pmap_contains(entity_reference_map, ent)) {
-               res = (ir_node **) pmap_get(entity_reference_map, ent);
-       } else {
+       ir_node **res = pmap_get(ir_node*, entity_reference_map, ent);
+       if (!res) {
                res = NEW_ARR_F(ir_node *, 0);
                pmap_insert(entity_reference_map, ent, (void *)res);
        }
@@ -94,9 +88,7 @@ static ir_node **get_entity_reference_array(const ir_entity *ent)
 
 static void set_entity_reference_array(const ir_entity *ent, ir_node **refs)
 {
-       ir_node **old = (ir_node**)pmap_get(entity_reference_map, ent);
-       if (old != refs)
-               pmap_insert(entity_reference_map, ent, (void *)refs);
+       pmap_insert(entity_reference_map, ent, (void *)refs);
 }
 
 /**
@@ -105,12 +97,10 @@ static void set_entity_reference_array(const ir_entity *ent, ir_node **refs)
  */
 static ir_node **get_type_alloc_array(const ir_type *tp)
 {
-       ir_node **res;
        if (!type_alloc_map) type_alloc_map = pmap_create();
 
-       if (pmap_contains(type_alloc_map, tp)) {
-               res = (ir_node **) pmap_get(type_alloc_map, tp);
-       } else {
+       ir_node **res = pmap_get(ir_node*, type_alloc_map, tp);
+       if (!res) {
                res = NEW_ARR_F(ir_node *, 0);
                pmap_insert(type_alloc_map, tp, (void *)res);
        }
@@ -120,9 +110,7 @@ static ir_node **get_type_alloc_array(const ir_type *tp)
 
 static void set_type_alloc_array(const ir_type *tp, ir_node **alls)
 {
-       ir_node **old = (ir_node**)pmap_get(type_alloc_map, tp);
-       if (old != alls)
-               pmap_insert(type_alloc_map, tp, (void *)alls);
+       pmap_insert(type_alloc_map, tp, (void *)alls);
 }
 
 /**
@@ -131,12 +119,10 @@ static void set_type_alloc_array(const ir_type *tp, ir_node **alls)
  */
 static ir_node **get_type_cast_array(const ir_type *tp)
 {
-       ir_node **res;
        if (!type_cast_map) type_cast_map = pmap_create();
 
-       if (pmap_contains(type_cast_map, tp)) {
-               res = (ir_node **) pmap_get(type_cast_map, tp);
-       } else {
+       ir_node **res = pmap_get(ir_node*, type_cast_map, tp);
+       if (!res) {
                res = NEW_ARR_F(ir_node *, 0);
                pmap_insert(type_cast_map, tp, (void *)res);
        }
@@ -145,9 +131,7 @@ static ir_node **get_type_cast_array(const ir_type *tp)
 
 static void set_type_cast_array(const ir_type *tp, ir_node **alls)
 {
-       ir_node **old = (ir_node**)pmap_get(type_cast_map, tp);
-       if (old != alls)
-               pmap_insert(type_cast_map, tp, (void *)alls);
+       pmap_insert(type_cast_map, tp, (void *)alls);
 }
 
 /**
@@ -156,12 +140,10 @@ static void set_type_cast_array(const ir_type *tp, ir_node **alls)
  */
 static ir_type **get_type_pointertype_array(const ir_type *tp)
 {
-       ir_type **res;
        if (!type_pointertype_map) type_pointertype_map = pmap_create();
 
-       if (pmap_contains(type_pointertype_map, tp)) {
-               res = (ir_type **) pmap_get(type_pointertype_map, tp);
-       } else {
+       ir_type **res = pmap_get(ir_type*, type_pointertype_map, tp);
+       if (!res) {
                res = NEW_ARR_F(ir_type *, 0);
                pmap_insert(type_pointertype_map, tp, (void *)res);
        }
@@ -171,9 +153,7 @@ static ir_type **get_type_pointertype_array(const ir_type *tp)
 
 static void set_type_pointertype_array(const ir_type *tp, ir_type **pts)
 {
-       ir_type **old = (ir_type**)pmap_get(type_pointertype_map, tp);
-       if (old != pts)
-               pmap_insert(type_pointertype_map, tp, (void *)pts);
+       pmap_insert(type_pointertype_map, tp, (void *)pts);
 }
 
 /**
@@ -182,12 +162,10 @@ static void set_type_pointertype_array(const ir_type *tp, ir_type **pts)
  */
 static ir_type **get_type_arraytype_array(const ir_type *tp)
 {
-       ir_type **res;
        if (!type_arraytype_map) type_arraytype_map = pmap_create();
 
-       if (pmap_contains(type_arraytype_map, tp)) {
-               res = (ir_type **) pmap_get(type_arraytype_map, tp);
-       } else {
+       ir_type **res = pmap_get(ir_type*, type_arraytype_map, tp);
+       if (!res) {
                res = NEW_ARR_F(ir_type *, 0);
                pmap_insert(type_arraytype_map, tp, (void *)res);
        }
@@ -197,9 +175,7 @@ static ir_type **get_type_arraytype_array(const ir_type *tp)
 
 static void set_type_arraytype_array(const ir_type *tp, ir_type **pts)
 {
-       ir_type **old = (ir_type**)pmap_get(type_arraytype_map, tp);
-       if (old != pts)
-               pmap_insert(type_arraytype_map, tp, (void *)pts);
+       pmap_insert(type_arraytype_map, tp, (void *)pts);
 }
 
 /*------------------------------------------------------------------*/
@@ -244,19 +220,6 @@ static void add_entity_access(const ir_entity *ent, ir_node *n)
        set_entity_access_array(ent, accs);
 }
 
-#if 0
-void set_entity_access(const ir_entity *ent, int pos, ir_node *n)
-{
-       ir_node ** accs;
-
-       assert(0 <= pos && pos < get_entity_n_accesses(ent));
-       assert(n && is_ir_node(n));
-
-       accs = get_entity_access_array(ent);
-       accs[pos] = n;
-}
-#endif
-
 /*------------------------------------------------------------------*/
 
 size_t get_entity_n_references(const ir_entity *ent)
@@ -291,19 +254,6 @@ static void add_entity_reference(const ir_entity *ent, ir_node *n)
        set_entity_reference_array(ent, refs);
 }
 
-#if 0
-void set_entity_reference(const ir_entity *ent, int pos, ir_node *n)
-{
-       ir_node ** refs;
-
-       assert(0 <= pos && pos < get_entity_n_references(ent));
-       assert(n && is_ir_node(n));
-
-       refs = get_entity_reference_array(ent);
-       refs[pos] = n;
-}
-#endif
-
 /**------------------------------------------------------------------*/
 /*   Access routines for types                                       */
 /**------------------------------------------------------------------*/
@@ -341,19 +291,6 @@ static void add_type_alloc(const ir_type *tp, ir_node *n)
        set_type_alloc_array(tp, allocs);
 }
 
-#if 0
-void set_type_alloc(const ir_type *tp, int pos, ir_node *n)
-{
-       ir_node **allocs;
-
-       assert(0 <= pos && pos < get_type_n_allocs(tp));
-       assert(n && is_ir_node(n));
-
-       allocs = get_type_alloc_array(tp);
-       allocs[pos] = n;
-}
-#endif
-
 /* Number of Cast nodes that create an instance of this type */
 size_t get_type_n_casts(const ir_type *tp)
 {
@@ -411,19 +348,6 @@ void add_type_cast(const ir_type *tp, ir_node *n)
        set_type_cast_array(tp, casts);
 }
 
-#if 0
-void set_type_cast(const ir_type *tp, size_t pos, ir_node *n)
-{
-       ir_node **casts;
-
-       assert(pos < get_type_n_casts(tp));
-       assert(n && is_ir_node(n));
-
-       casts = get_type_cast_array(tp);
-       casts[pos] = n;
-}
-#endif
-
 /*------------------------------------------------------------------*/
 
 size_t get_type_n_pointertypes_to(const ir_type *tp)
@@ -458,19 +382,6 @@ void add_type_pointertype_to(const ir_type *tp, ir_type *ptp)
        set_type_pointertype_array(tp, pts);
 }
 
-#if 0
-void set_type_pointertype_to(const ir_type *tp, int pos, ir_type *ptp)
-{
-       ir_type ** pts;
-
-       assert(0 <= pos && pos < get_type_n_pointertypes_to(tp));
-       assert(ptp && is_Pointer_type(ptp));
-
-       pts = get_type_pointertype_array(tp);
-       pts[pos] = ptp;
-}
-#endif
-
 /*------------------------------------------------------------------*/
 
 size_t get_type_n_arraytypes_of(const ir_type *tp)
@@ -505,19 +416,6 @@ void  add_type_arraytype_of(const ir_type *tp, ir_type *atp)
        set_type_arraytype_array(tp, pts);
 }
 
-#if 0
-void  set_type_arraytype_of(const ir_type *tp, int pos, ir_type *atp)
-{
-       ir_type ** pts;
-
-       assert(0 <= pos && pos < get_type_n_arraytypes_of(tp));
-       assert(atp && is_Array_type(atp));
-
-       pts = get_type_arraytype_array(tp);
-       pts[pos] = atp;
-}
-#endif
-
 /*------------------------------------------------------------------*/
 /* Building and Removing the out datastructure                      */
 /*------------------------------------------------------------------*/