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 */
32 type *tp; /* type of described object */
35 typedef struct obj_obj_desc_str
37 obj_kind_t kind; /* always written obj_kind_obj */
38 struct obj_desc_str *next; /* link all descrs into a linked list */
39 type *tp; /* type of described object */
40 entity **fields; /* fields of described object */
41 int n_fields; /* number of fields */
42 qset_t **vals; /* qsets of values of the fields */
45 typedef struct obj_arr_desc_str
47 obj_kind_t kind; /* always written obj_kind_array */
48 struct obj_desc_str *next; /* link all descrs into a linked list */
49 type *tp; /* (array) type of described object */
50 qset_t *val; /* all values of 'the' 'field' */
53 typedef struct pto_str
55 void *kind; /* always written to &pto_id */
56 ir_node *node; /* Rubbish: node for which this pto_t was constructed */
57 int is_dummy; /* allow to filter out dummy values */
58 qset_t *objs; /* qset of obj_desc_t* */
62 /* Get the entity of a ptr */
63 entity *get_ptr_ent (ir_node*);
65 /* Ctors for the pto types */
66 obj_desc_t *obj_desc_new (type*);
68 /* Deallocate an obj desc */
69 void obj_desc_delete (obj_desc_t*);
71 /* List all obj descs that have been created. If tp is given non-NULL,
72 only descs for this type are listed, else all types are listed. */
73 void obj_desc_list_all (type*);
75 /* Create a new pto value containing a name of the given type. */
76 pto_t *pto_new_name (ir_node*, type*);
78 /* Create a new pto value containing no names. */
79 pto_t *pto_new_empty (ir_node*);
81 /* Deallocate a pto */
82 void pto_delete (pto_t*);
84 /* Sanity checking on a pto_t */
85 void check_pto (pto_t*);
87 /* Add the given name to the given pto. */
88 void pto_add_name (pto_t*, obj_desc_t*);
90 /* Add all the given names to the given pto. */
91 void pto_add_all_names (pto_t*, qset_t*);
93 /* Mark the given pto as a dumy */
94 void pto_set_dummy (pto_t*);
96 /* Say whether the given pto is a dummy */
97 int pto_is_dummy (pto_t*);
99 /* Find the arguments of a graph. For a method that has n args, the
100 result array has 'n+1' entries, the last of which is written NULL.
101 If an argument is not used, it is also written NULL in this array. */
102 ir_node **find_irg_args (ir_graph*);
103 /* int is_field (entity*); */
106 /* Perform a lookup of the contents of the given field in the given pto */
107 qset_t *pto_lookup (obj_desc_t*, entity*);
109 # endif /* not defined _PTO_UTIL_H_ */
114 Revision 1.3 2004/11/08 12:33:06 liekweg
115 initialisation; sanitize print levels, misc fixes
117 Revision 1.2 2004/11/04 14:58:38 liekweg
118 expanded pto, added initialisation, added debugging printing
120 Revision 1.1 2004/10/22 15:10:51 liekweg
121 moved utils to pto_util