5 * File name: ir/ana2/pto_util.c
6 * Purpose: Pto Utilities
9 * Created: Mon 18 Oct 2004
11 * Copyright: (c) 1999-2004 Universität Karlsruhe
12 * Licence: This file is protected by GPL - GNU GENERAL PUBLIC LICENSE.
21 # define N_INITIAL_OBJS 5
23 typedef enum obj_kind_enum {
28 typedef struct obj_desc_str
30 obj_kind_t kind; /* written obj_kind_obj or obj_kind_array */
31 struct obj_desc_str *next; /* link all descrs into a linked list */
33 int is_dummy; /* allow to filter out dummy objects */
34 # endif /* defined PTO_DUMMY */
35 type *tp; /* type of described object */
38 typedef struct obj_obj_desc_str
40 obj_kind_t kind; /* always written obj_kind_obj */
41 struct obj_desc_str *next; /* link all descrs into a linked list */
43 int is_dummy; /* allow to filter out dummy objects */
44 # endif /* defined PTO_DUMMY */
45 type *tp; /* type of described object */
46 entity **fields; /* fields of described object */
47 int n_fields; /* number of fields */
48 qset_t **vals; /* qsets of values of the fields */
51 typedef struct obj_arr_desc_str
53 obj_kind_t kind; /* always written obj_kind_array */
54 struct obj_desc_str *next; /* link all descrs into a linked list */
56 int is_dummy; /* allow to filter out dummy objects */
57 # endif /* defined PTO_DUMMY */
58 type *tp; /* (array) type of described object */
59 qset_t *val; /* all values of 'the' 'field' */
62 typedef struct pto_str
64 void *kind; /* always written to &pto_id */
65 ir_node *node; /* Rubbish: node for which this pto_t was constructed */
66 qset_t *objs; /* qset of obj_desc_t* */
70 /* Get the entity of a ptr */
71 entity *get_ptr_ent (ir_node*);
73 /* Ctors for the pto types */
74 obj_desc_t *obj_desc_new (type*);
77 /* Mark an obj desc as a dummy */
78 void obj_desc_set_dummy (obj_desc_t*);
80 /* Say whether an obj desc is a dummy */
81 int obj_desc_is_dummy (obj_desc_t*);
82 # endif /* defined PTO_DUMMY */
85 /* Deallocate an obj desc */
86 void obj_desc_delete (obj_desc_t*);
88 /* List all obj descs that have been created. If tp is given non-NULL,
89 only descs for this type are listed, else all types are listed. */
90 void obj_desc_list_all (type*);
92 /* Create a new pto value containing a name of the given type. */
93 pto_t *pto_new_name (ir_node*, type*);
95 /* Create a new pto value containing no names. */
96 pto_t *pto_new_empty (ir_node*);
98 /* Deallocate a pto */
99 void pto_delete (pto_t*);
101 /* Sanity checking on a pto_t */
102 void check_pto (pto_t*);
104 /* Add the given name to the given pto. */
105 void pto_add_name (pto_t*, obj_desc_t*);
107 /* Add all the given names to the given pto. */
108 void pto_add_all_names (pto_t*, qset_t*);
111 /* Find the arguments of a graph. For a method that has n args, the
112 result array has 'n+1' entries, the last of which is written NULL.
113 If an argument is not used, it is also written NULL in this array. */
114 ir_node **find_irg_args (ir_graph*);
115 /* int is_field (entity*); */
118 /* Perform a lookup of the contents of the given field in the given pto */
119 qset_t *pto_lookup (obj_desc_t*, entity*);
121 # endif /* not defined _PTO_UTIL_H_ */
126 Revision 1.2 2004/11/04 14:58:38 liekweg
127 expanded pto, added initialisation, added debugging printing
129 Revision 1.1 2004/10/22 15:10:51 liekweg
130 moved utils to pto_util