Changed implementation of tr module.
[libfirm] / ir / ir / irgraph.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 # ifndef _IRGRAPH_H_
10 # define _IRGRAPH_H_
11 # include "tv.h"
12
13 /* to resolve recursion between irnode.h and irgraph.h */
14 #ifndef _IR_NODE_TYPEDEF_
15 #define _IR_NODE_TYPEDEF_
16 typedef struct ir_node ir_node;
17 #endif
18
19 /* to resolve recursion between entity.h and irgraph.h */
20 #ifndef _IR_GRAPH_TYPEDEF_
21 #define _IR_GRAPH_TYPEDEF_
22 typedef struct ir_graph ir_graph;
23 #endif
24
25 /* Global variable holding the current_ir_graph.  This global variable
26    is used by the ir construction interface in ircons and by the
27    optimizations. */
28 extern ir_graph *current_ir_graph;
29
30 /* Create a new ir graph to built ir for a procedure.
31    ent is the entity representing this procedure, i.e., the type of the
32    entity must be of a method type.  The constructor automatically sets the
33    field irg of the entity to the new ir graph.
34    n_loc is the number of local variables in this procedure including
35    the procedure parameters. */
36 ir_graph *new_ir_graph (entity *ent, int n_loc);
37
38 /* access routines for all ir_graph attributes */
39 ir_node *get_irg_start_block (ir_graph *irg);
40 void     set_irg_start_block (ir_graph *irg, ir_node *node);
41
42 ir_node *get_irg_start (ir_graph *irg);
43 void     set_irg_start (ir_graph *irg, ir_node *node);
44
45 ir_node *get_irg_end_block (ir_graph *irg);
46 void     set_irg_end_block (ir_graph *irg, ir_node *node);
47
48 ir_node *get_irg_end (ir_graph *irg);
49 void     set_irg_end (ir_graph *irg, ir_node *node);
50
51 ir_node *get_irg_cstore (ir_graph *irg);
52 void     set_irg_cstore (ir_graph *irg, ir_node *node);
53
54 ir_node *get_irg_frame (ir_graph *irg);
55 void     set_irg_frame (ir_graph *irg, ir_node *node);
56
57 ir_node *get_irg_globals (ir_graph *irg);
58 void     set_irg_globals (ir_graph *irg, ir_node *node);
59
60 ir_node *get_irg_args (ir_graph *irg);
61 void     set_irg_args (ir_graph *irg, ir_node *node);
62
63 /* Use new_Bad() instead!! */
64 ir_node *get_irg_bad (ir_graph *irg);
65 void     set_irg_bad (ir_graph *irg, ir_node *node);
66
67 ir_node *get_irg_current_block (ir_graph *irg);
68 void     set_irg_current_block (ir_graph *irg, ir_node *node);
69
70 entity  *get_irg_ent (ir_graph *irg);
71 void     set_irg_ent (ir_graph *irg, entity *ent);
72
73 /* Use not encouraged, internal of Phi construction algorithm. */
74 int      get_irg_n_loc (ir_graph *irg);
75 void     set_irg_n_loc (ir_graph *irg, int n_loc);
76
77 /* increments visited by one */
78 void     inc_irg_visited(ir_graph *irg);
79 unsigned long get_irg_visited (ir_graph *irg);
80 void     set_irg_visited(ir_graph *irg, unsigned long i);
81
82 /* increments block_visited by one */
83 void     inc_irg_block_visited(ir_graph *irg);
84 unsigned long get_irg_block_visited (ir_graph *irg);
85 void     set_irg_block_visited(ir_graph *irg, unsigned long i);
86
87 # endif /* _IRGRAPH_H_ */