new DBGEXE macro
[libfirm] / ir / ana2 / pto_util.h
1 /* -*- c -*- */
2
3 /*
4  * Project:     libFIRM
5  * File name:   ir/ana2/pto_util.c
6  * Purpose:     Pto Utilities
7  * Author:      Florian
8  * Modified by:
9  * Created:     Mon 18 Oct 2004
10  * CVS-ID:      $Id$
11  * Copyright:   (c) 1999-2004 Universität Karlsruhe
12  * Licence:     This file is protected by GPL -  GNU GENERAL PUBLIC LICENSE.
13  */
14
15 # ifndef _PTO_UTIL_H_
16 # define _PTO_UTIL_H_
17
18 # include "irgraph.h"
19 # include "qset.h"
20
21 # define N_INITIAL_OBJS         5
22
23 typedef enum obj_kind_enum {
24   obj_kind_obj,
25   obj_kind_array,
26 } obj_kind_t;
27
28 typedef struct obj_desc_str
29 {
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 */
33 } obj_desc_t;
34
35 typedef struct obj_obj_desc_str
36 {
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 */
43 } obj_obj_desc_t;
44
45 typedef struct obj_arr_desc_str
46 {
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' */
51 } obj_arr_desc_t;
52
53 typedef struct pto_str
54 {
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* */
59 } pto_t;
60
61
62 /* Get the entity of a ptr */
63 entity *get_ptr_ent (ir_node*);
64
65 /* Ctors for the pto types */
66 obj_desc_t *obj_desc_new (type*);
67
68 /* Deallocate an obj desc */
69 void obj_desc_delete (obj_desc_t*);
70
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*);
74
75 /* Create a new pto value containing a name of the given type. */
76 pto_t *pto_new_name (ir_node*, type*);
77
78 /* Create a new pto value containing no names. */
79 pto_t *pto_new_empty (ir_node*);
80
81 /* Deallocate a pto */
82 void pto_delete (pto_t*);
83
84 /* Sanity checking on a pto_t */
85 void check_pto (pto_t*);
86
87 /*   Add the given name to the given pto. */
88 void pto_add_name (pto_t*, obj_desc_t*);
89
90 /* Add all the given names to the given pto. */
91 void pto_add_all_names (pto_t*, qset_t*);
92
93 /* Mark the given pto as a dumy */
94 void pto_set_dummy (pto_t*);
95
96 /* Say whether the given pto is a dummy */
97 int pto_is_dummy (pto_t*);
98
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*); */
104
105
106 /* Perform a lookup of the contents of the given field in the given pto */
107 qset_t *pto_lookup (obj_desc_t*, entity*);
108
109 # endif /* not defined _PTO_UTIL_H_ */
110
111 \f
112 /*
113   $Log$
114   Revision 1.3  2004/11/08 12:33:06  liekweg
115   initialisation; sanitize print levels, misc fixes
116
117   Revision 1.2  2004/11/04 14:58:38  liekweg
118   expanded pto, added initialisation, added debugging printing
119
120   Revision 1.1  2004/10/22 15:10:51  liekweg
121   moved utils to pto_util
122
123
124  */