# ifndef _IRGRAPH_H_
# define _IRGRAPH_H_
-
-/* # include "lib/obstack.h" */
-
-
-/*# include "irnode.h" */
-# include "obst.h"
# include "tv.h"
-# include "pset.h"
-
-/* @@@ we need at most a subset */
-# include "entity.h"
-
+/* to resolve recursion between irnode.h and irgraph.h */
#ifndef _IR_NODE_TYPEDEF_
#define _IR_NODE_TYPEDEF_
-
-/* to resolve recursion between irnode.h and irgraph.h */
typedef struct ir_node ir_node;
-
#endif
-/* ir_graph holds all information for a procedure */
-typedef struct {
- struct entity *ent; /* The entity of this procedure, i.e., the
- type of the procedure and the class it
- belongs to. */
- struct ir_node *start_block; /* block the start node will belong to */
- struct ir_node *start; /* start node of this ir_graph */
- struct ir_node *end_block; /* block the end node will belong to */
- struct ir_node *end; /* end node of this ir_graph */
- struct ir_node *cstore; /* constant store */
- struct ir_node *frame; /* method's frame */
-#if UEBPRAKT
- struct ir_node *dataseg; /* pointer to the data segment */
-#endif
- struct ir_node *args; /* methods arguments */
- struct ir_node *bad; /* bad node of this ir_graph, the one and
- only in this graph */
- struct obstack *obst; /* obstack where all of the ir_nodes live */
-#if USE_EXPICIT_PHI_IN_STACK
- struct Phi_in_stack *Phi_in_stack; /* needed for automatic Phi construction */
+/* to resolve recursion between entity.h and irgraph.h */
+#ifndef _IR_GRAPH_TYPEDEF_
+#define _IR_GRAPH_TYPEDEF_
+typedef struct ir_graph ir_graph;
#endif
- struct ir_node *current_block; /* block for newly gen_*()-erated ir_nodes */
- int params; /* number of local variable in this procedure */
- // should be n_loc or so, params is ambiguous.
- pset *value_table; /* value table for global value numbering
- for optimizing use in iropt.c */
-} ir_graph;
+/* Global variable holding the current_ir_graph. This global variable
+ is used by the ir construction interface in ircons and by the
+ optimizations. */
extern ir_graph *current_ir_graph;
-/* create a new ir graph */
-ir_graph *new_ir_graph (entity *ent, int params);
-
-extern unsigned long ir_visited;
-extern unsigned long block_visited;
+/* Create a new ir graph to built ir for a procedure.
+ ent is the entity representing this procedure, i.e., the type of the
+ entity must be type_method. The constructor automatically sets the
+ field irg of the entity to the new ir graph.
+ n_loc is the number of local variables in this procedure including
+ the procedure parameters. */
+ir_graph *new_ir_graph (entity *ent, int n_loc);
/* access routines for all ir_graph attributes */
+ir_node *get_irg_start_block (ir_graph *irg);
+void set_irg_start_block (ir_graph *irg, ir_node *node);
-ir_node *get_start_block_of_irgraph (ir_graph *irg);
-void set_start_block_of_irgraph (ir_graph *irg, ir_node *node);
+ir_node *get_irg_start (ir_graph *irg);
+void set_irg_start (ir_graph *irg, ir_node *node);
-ir_node *get_start_of_irgraph (ir_graph *irg);
-void set_start_of_irgraph(ir_graph *irg, ir_node *node);
+ir_node *get_irg_end_block (ir_graph *irg);
+void set_irg_end_block (ir_graph *irg, ir_node *node);
-ir_node *get_end_block_of_irgraph (ir_graph *irg);
-void set_end_block_of_irgraph (ir_graph *irg, ir_node *node);
+ir_node *get_irg_end (ir_graph *irg);
+void set_irg_end (ir_graph *irg, ir_node *node);
-ir_node *get_end_of_irgraph (ir_graph *irg);
-void set_end_of_irgraph (ir_graph *irg, ir_node *node);
+ir_node *get_irg_cstore (ir_graph *irg);
+void set_irg_cstore (ir_graph *irg, ir_node *node);
-ir_node *get_cstore_of_irgraph (ir_graph *irg);
-void set_cstore_of_irgraph (ir_graph *irg, ir_node *node);
+ir_node *get_irg_frame (ir_graph *irg);
+void set_irg_frame (ir_graph *irg, ir_node *node);
-ir_node *get_frame_of_irgraph (ir_graph *irg);
-void set_frame_of_irgraph (ir_graph *irg, ir_node *node);
+ir_node *get_irg_globals (ir_graph *irg);
+void set_irg_globals (ir_graph *irg, ir_node *node);
-ir_node *get_args_of_irgraph (ir_graph *irg);
-void set_args_of_irgraph (ir_graph *irg, ir_node *node);
+ir_node *get_irg_args (ir_graph *irg);
+void set_irg_args (ir_graph *irg, ir_node *node);
-ir_node *get_bad_of_irgraph (ir_graph *irg);
-void set_bad_of_irgraph (ir_graph *irg, ir_node *node);
+/* Use new_Bad() instead!! */
+ir_node *get_irg_bad (ir_graph *irg);
+void set_irg_bad (ir_graph *irg, ir_node *node);
-/* not implemented yet
-struct obstack *get_obst_of_irgraph (ir_graph *irg);
-void set_obst_of_irgraph (ir_graph *irg, struct obstack *obst);
-*/
+ir_node *get_irg_current_block (ir_graph *irg);
+void set_irg_current_block (ir_graph *irg, ir_node *node);
+
+entity *get_irg_ent (ir_graph *irg);
+void set_irg_ent (ir_graph *irg, entity *ent);
-ir_node *get_current_block_of_irgraph (ir_graph *irg);
-void set_current_block_of_irgraph (ir_graph *irg, ir_node *node);
+/* Use not encouraged, internal of Phi construction algorithm. */
+int get_irg_n_loc (ir_graph *irg);
+void set_irg_n_loc (ir_graph *irg, int n_loc);
-entity *get_ent_of_irgraph (ir_graph *irg);
-void set_ent_of_irgraph (ir_graph *irg, entity *ent);
+/* increments visited by one */
+void inc_irg_visited(ir_graph *irg);
+unsigned long get_irg_visited (ir_graph *irg);
+void set_irg_visited(ir_graph *irg, unsigned long i);
-int get_params_of_irgraph (ir_graph *irg);
-void set_params_of_irgraph (ir_graph *irg, int params);
+/* increments block_visited by one */
+void inc_irg_block_visited(ir_graph *irg);
+unsigned long get_irg_block_visited (ir_graph *irg);
+void set_irg_block_visited(ir_graph *irg, unsigned long i);
# endif /* _IRGRAPH_H_ */