1 /* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
2 ** All rights reserved.
4 ** Authors: Martin Trapp, Christian Schaefer
6 ** irgraph.h: ir graph construction
15 /* @@@ we need at most a subset */
19 #ifndef _IR_NODE_TYPEDEF_
20 #define _IR_NODE_TYPEDEF_
21 /* to resolve recursion between irnode.h and irgraph.h */
22 typedef struct ir_node ir_node;
25 /* ir_graph holds all information for a procedure */
27 struct entity *ent; /* The entity of this procedure, i.e., the
28 type of the procedure and the class it
30 struct ir_node *start_block; /* block the start node will belong to */
31 struct ir_node *start; /* start node of this ir_graph */
32 struct ir_node *end_block; /* block the end node will belong to */
33 struct ir_node *end; /* end node of this ir_graph */
34 struct ir_node *cstore; /* constant store */
35 struct ir_node *frame; /* method's frame */
36 struct ir_node *globals; /* pointer to the data segment containing all globals as
37 well as global procedures. */
38 struct ir_node *args; /* methods arguments */
39 struct ir_node *bad; /* bad node of this ir_graph, the one and
41 struct obstack *obst; /* obstack where all of the ir_nodes live */
42 #if USE_EXPICIT_PHI_IN_STACK
43 struct Phi_in_stack *Phi_in_stack; /* needed for automatic Phi construction */
45 struct ir_node *current_block; /* block for newly gen_*()-erated ir_nodes */
46 int params; /* number of local variable in this procedure */
47 // should be n_loc or so, params is ambiguous.
48 pset *value_table; /* value table for global value numbering / cse
49 for optimizing use in iropt.c */
53 /* Global variable holding the current_ir_graph. This global variable
54 is used by the ir construction interface in ircons and by the
56 extern ir_graph *current_ir_graph;
58 /* create a new ir graph */
59 ir_graph *new_ir_graph (entity *ent, int params);
61 extern unsigned long ir_visited;
62 extern unsigned long block_visited;
64 /* access routines for all ir_graph attributes */
66 ir_node *get_start_block_of_irgraph (ir_graph *irg);
67 void set_start_block_of_irgraph (ir_graph *irg, ir_node *node);
69 ir_node *get_start_of_irgraph (ir_graph *irg);
70 void set_start_of_irgraph(ir_graph *irg, ir_node *node);
72 ir_node *get_end_block_of_irgraph (ir_graph *irg);
73 void set_end_block_of_irgraph (ir_graph *irg, ir_node *node);
75 ir_node *get_end_of_irgraph (ir_graph *irg);
76 void set_end_of_irgraph (ir_graph *irg, ir_node *node);
78 ir_node *get_cstore_of_irgraph (ir_graph *irg);
79 void set_cstore_of_irgraph (ir_graph *irg, ir_node *node);
81 ir_node *get_frame_of_irgraph (ir_graph *irg);
82 void set_frame_of_irgraph (ir_graph *irg, ir_node *node);
85 ir_node *get_irg_globals (ir_graph *irg);
86 void set_irg_globals (ir_graph *irg, ir_node *node);
89 ir_node *get_args_of_irgraph (ir_graph *irg);
90 void set_args_of_irgraph (ir_graph *irg, ir_node *node);
92 ir_node *get_bad_of_irgraph (ir_graph *irg);
93 void set_bad_of_irgraph (ir_graph *irg, ir_node *node);
95 /* not implemented yet
96 struct obstack *get_obst_of_irgraph (ir_graph *irg);
97 void set_obst_of_irgraph (ir_graph *irg, struct obstack *obst);
100 ir_node *get_current_block_of_irgraph (ir_graph *irg);
101 void set_current_block_of_irgraph (ir_graph *irg, ir_node *node);
103 entity *get_ent_of_irgraph (ir_graph *irg);
104 void set_ent_of_irgraph (ir_graph *irg, entity *ent);
106 int get_params_of_irgraph (ir_graph *irg);
107 void set_params_of_irgraph (ir_graph *irg, int params);
109 # endif /* _IRGRAPH_H_ */