better name, new access routine
authorGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Mon, 25 Aug 2003 08:22:50 +0000 (08:22 +0000)
committerGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Mon, 25 Aug 2003 08:22:50 +0000 (08:22 +0000)
[r1756]

ir/tr/tpop.c
ir/tr/type.c
ir/tr/type.h

index 0112caa..8eeec1f 100644 (file)
@@ -55,8 +55,8 @@ init_tpop(void)
   type_pointer     = new_tpop (tpo_pointer    , id_from_str("pointer"     , 7), sizeof (ptr_attr));
   type_primitive   = new_tpop (tpo_primitive  , id_from_str("primitive"   , 9), /* sizeof (pri_attr) */ 0);
   type_id          = new_tpop (tpo_id         , id_from_str("type_id"     , 7), /* sizeof (id_attr)  */ 0);
-  tpop_none        = new_tpop (tpo_none       , id_from_str("type_none"   , 9), /* sizeof (non_attr) */ 0);
-  tpop_unknown     = new_tpop (tpo_unknown    , id_from_str("type_unknown",12), /* sizeof (ukn_attr) */ 0);
+  tpop_none        = new_tpop (tpo_none       , id_from_str("tpop_none"   , 9), /* sizeof (non_attr) */ 0);
+  tpop_unknown     = new_tpop (tpo_unknown    , id_from_str("tpop_unknown",12), /* sizeof (ukn_attr) */ 0);
 }
 
 /* Returns the string for the tp_opcode. */
index f1d1e36..ec71e02 100644 (file)
@@ -1340,6 +1340,20 @@ bool  is_pointer_type            (type *pointer) {
   if (pointer->type_op == type_pointer) return 1; else return 0;
 }
 
+/* Returns the first pointer type that has as points_to tp.
+ *  Not efficient: O(#types).
+ *  If not found returns unknown_type. */
+type *find_pointer_type_to_type (type *tp) {
+  int i;
+  for (i = 0; i < get_irp_n_types(); ++i) {
+    type *found = get_irp_type(i);
+    if (is_pointer_type(found) && get_pointer_points_to_type(found) == tp)
+      return (found);
+  }
+  return unknown_type;
+}
+
+
 
 /*******************************************************************/
 /** TYPE_PRIMITIVE                                                **/
index a364800..e5db6fd 100644 (file)
@@ -745,6 +745,11 @@ type *get_pointer_points_to_type (type *pointer);
 /** Returns true if a type is a pointer type. */
 bool  is_pointer_type            (type *pointer);
 
+/** Returns the first pointer type that has as points_to tp.
+ *  Not efficient: O(#types).
+ *  If not found returns unknown_type. */
+type *find_pointer_type_to_type (type *tp);
+
 /**
  * @page primitive_type Representation of a primitive type
  *