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