1 /* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
2 ** All rights reserved.
4 ** Authors: Martin Trapp, Christian Schaefer
6 ** irgraph.h: ir graph construction
12 /* # include "lib/obstack.h" */
15 /*# include "irnode.h" */
20 /* @@@ we need at most a subset */
24 #ifndef _IR_NODE_TYPEDEF_
25 #define _IR_NODE_TYPEDEF_
27 /* to resolve recursion between irnode.h and irgraph.h */
28 typedef struct ir_node ir_node;
32 /* ir_graph holds all information for a procedure */
34 struct entity *ent; /* The entity of this procedure, i.e., the
35 type of the procedure and the class it
37 struct ir_node *start_block; /* block the start node will belong to */
38 struct ir_node *start; /* start node of this ir_graph */
39 struct ir_node *end_block; /* block the end node will belong to */
40 struct ir_node *end; /* end node of this ir_graph */
41 struct ir_node *cstore; /* constant store */
42 struct ir_node *frame; /* method's frame */
44 struct ir_node *dataseg; /* pointer to the data segment */
46 struct ir_node *args; /* methods arguments */
47 struct ir_node *bad; /* bad node of this ir_graph, the one and
49 struct obstack *obst; /* obstack where all of the ir_nodes live */
50 #if USE_EXPICIT_PHI_IN_STACK
51 struct Phi_in_stack *Phi_in_stack; /* needed for automatic Phi construction */
53 struct ir_node *current_block; /* block for newly gen_*()-erated ir_nodes */
54 int params; /* number of local variable in this procedure */
55 // should be n_loc or so, params is ambiguous.
56 pset *value_table; /* value table for global value numbering
57 for optimizing use in iropt.c */
60 extern ir_graph *current_ir_graph;
62 /* create a new ir graph */
63 ir_graph *new_ir_graph (entity *ent, int params);
65 extern unsigned long ir_visited;
66 extern unsigned long block_visited;
68 /* access routines for all ir_graph attributes */
70 ir_node *get_start_block_of_irgraph (ir_graph *irg);
71 void set_start_block_of_irgraph (ir_graph *irg, ir_node *node);
73 ir_node *get_start_of_irgraph (ir_graph *irg);
74 void set_start_of_irgraph(ir_graph *irg, ir_node *node);
76 ir_node *get_end_block_of_irgraph (ir_graph *irg);
77 void set_end_block_of_irgraph (ir_graph *irg, ir_node *node);
79 ir_node *get_end_of_irgraph (ir_graph *irg);
80 void set_end_of_irgraph (ir_graph *irg, ir_node *node);
82 ir_node *get_cstore_of_irgraph (ir_graph *irg);
83 void set_cstore_of_irgraph (ir_graph *irg, ir_node *node);
85 ir_node *get_frame_of_irgraph (ir_graph *irg);
86 void set_frame_of_irgraph (ir_graph *irg, ir_node *node);
88 ir_node *get_args_of_irgraph (ir_graph *irg);
89 void set_args_of_irgraph (ir_graph *irg, ir_node *node);
91 ir_node *get_bad_of_irgraph (ir_graph *irg);
92 void set_bad_of_irgraph (ir_graph *irg, ir_node *node);
94 /* not implemented yet
95 struct obstack *get_obst_of_irgraph (ir_graph *irg);
96 void set_obst_of_irgraph (ir_graph *irg, struct obstack *obst);
99 ir_node *get_current_block_of_irgraph (ir_graph *irg);
100 void set_current_block_of_irgraph (ir_graph *irg, ir_node *node);
102 entity *get_ent_of_irgraph (ir_graph *irg);
103 void set_ent_of_irgraph (ir_graph *irg, entity *ent);
105 int get_params_of_irgraph (ir_graph *irg);
106 void set_params_of_irgraph (ir_graph *irg, int params);
108 # endif /* _IRGRAPH_H_ */