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. */
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 **/
/** 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
*