obstack access function
[libfirm] / ir / ir / irgraph_t.h
1 /* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
2 * All rights reserved.
3 */
4
5 /**
6 * @file irgraph_t.h
7 *
8 * ir graph construction.
9 *
10 * @author Martin Trapp, Christian Schaefer
11 */
12
13 /* $Id$ */
14
15 # ifndef _IRGRAPH_T_H_
16 # define _IRGRAPH_T_H_
17 # include "obst.h"
18 # include "pset.h"
19 # include "irgraph.h"
20 # include "firm_common_t.h"
21
22 #define FRAME_TP_SUFFIX "frame_tp"
23
24 /** ir_graph holds all information for a procedure */
25 struct ir_graph {
26   /* --  Basics of the representation -- */
27   struct entity  *ent;               /**< The entity of this procedure, i.e.,
28                                         the type of the procedure and the
29                                         class it belongs to. */
30   struct type    *frame_type;        /**< A class type representing the stack frame.
31                                         Can include "inner" methods. */
32   struct ir_node *start_block;       /**< block the start node will belong to */
33   struct ir_node *start;             /**< start node of this ir_graph */
34   struct ir_node *end_block;         /**< block the end node will belong to */
35   struct ir_node *end;               /**< end node of this ir_graph */
36   struct ir_node *cstore;            /**< constant store -- no more needed!! */
37   struct ir_node *frame;             /**< method's frame */
38   struct ir_node *globals;           /**< pointer to the data segment containing all
39                                         globals as well as global procedures. */
40   struct ir_node *args;              /**< methods arguments */
41   struct ir_node *bad;               /**< bad node of this ir_graph, the one and
42                                         only in this graph */
43   struct ir_node *unknown;           /**< unknown node of this ir_graph */
44   struct obstack *obst;              /**< obstack where all of the ir_nodes live */
45   struct ir_node *current_block;     /**< block for newly gen_*()-erated
46                                         ir_nodes */
47
48   /* -- Fields indicating different states of irgraph -- */
49   irg_phase_state phase_state;       /**< compiler phase */
50   op_pinned pinned;                  /**< Flag for status of nodes */
51   irg_outs_state outs_state;         /**< Out edges. */
52   irg_dom_state dom_state;           /**< Dominator information */
53
54   /* -- Fields for construction -- */
55 #if USE_EXPLICIT_PHI_IN_STACK
56   struct Phi_in_stack *Phi_in_stack; /**< needed for automatic Phi construction */
57 #endif
58   int n_loc;                         /**< number of local variable in this
59                                         procedure including procedure parameters. */
60
61   /* -- Fields for optimizations / analysis information -- */
62   pset *value_table;                 /**< hash table for global value numbering (cse)
63                                         for optimizing use in iropt.c */
64   struct ir_node **outs;             /**< Space for the out arrays. */
65   struct ir_loop *loop;              /**< The outermost loop */
66   void *link;                        /**< A void* field to link any information to
67                                         the node. */
68
69   /* -- Fields for Walking the graph -- */
70   unsigned long visited;             /**< this flag is an identifier for
71                                         ir walk. it will be incremented
72                                         every time someone walks through
73                                         the graph */
74   unsigned long block_visited;       /**< same as visited, for a complete block */
75 #ifdef DEBUG_libfirm
76   int graph_nr;             /**< a unique graph number for each graph to make output
77                               readable. */
78 #endif
79 };
80
81 void init_irgraph(void);
82
83 /** Make a rudimentary ir graph for the constant code.
84    Must look like a correct irg, spare everything else. */
85 ir_graph *new_const_code_irg(void);
86
87 INLINE void
88 set_irg_pinned (ir_graph *irg, op_pinned p);
89
90 /** Returns the obstack associated with the graph. */
91 struct obstack get_irg_obstack(ir_graph *irg);
92
93 # endif /* _IRGRAPH_T_H_ */