Commit d84d8558 authored by Götz Lindenmaier's avatar Götz Lindenmaier
Browse files

better name, new access routine

[r1756]
parent 21cd22b1
......@@ -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. */
......
......@@ -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 **/
......
......@@ -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
*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment