CVS:
[libfirm] / ir / ir / irgraph.h
index b9a9bd3..af47542 100644 (file)
 
 # ifndef _IRGRAPH_H_
 # define _IRGRAPH_H_
-
-# include "obst.h"
 # include "tv.h"
-# include "pset.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 */
-struct ir_graph {
-  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 */
-  struct ir_node *globals;           /* pointer to the data segment containing all globals as
-                                     well as global procedures. */
-  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 */
-#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 */
-  unsigned long visited;             /* this flag is an identifier for
-                                       ir walk. it will be incremented,
-                                       every time, someone walk through
-                                       the graph */
-  unsigned long block_visited;       /* same as visited, for a
-                                       complete block */
-};
-
-
+/* to resolve recursion between entity.h and irgraph.h */
 #ifndef _IR_GRAPH_TYPEDEF_
 #define _IR_GRAPH_TYPEDEF_
-/* to resolve recursion between entity.h and irgraph.h */
 typedef struct ir_graph ir_graph;
 #endif
 
-
 /* 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.  Automatically sets the field irg of
-   entity to the new ir graph. */
-ir_graph *new_ir_graph (entity *ent, int params);
-
+/* 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);
+void     set_irg_start_block (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);
+void     set_irg_start (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);
+void     set_irg_end_block (ir_graph *irg, ir_node *node);
 
 ir_node *get_irg_end (ir_graph *irg);
-void set_irg_end (ir_graph *irg, ir_node *node);
+void     set_irg_end (ir_graph *irg, ir_node *node);
 
 ir_node *get_irg_cstore (ir_graph *irg);
-void set_irg_cstore (ir_graph *irg, ir_node *node);
+void     set_irg_cstore (ir_graph *irg, ir_node *node);
 
 ir_node *get_irg_frame (ir_graph *irg);
-void set_irg_frame (ir_graph *irg, ir_node *node);
+void     set_irg_frame (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_irg_args (ir_graph *irg);
-void set_irg_args (ir_graph *irg, ir_node *node);
+void     set_irg_args (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);
-*/
+void     set_irg_bad (ir_graph *irg, ir_node *node);
 
 ir_node *get_irg_current_block (ir_graph *irg);
-void set_irg_current_block (ir_graph *irg, ir_node *node);
+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);
+entity  *get_irg_ent (ir_graph *irg);
+void     set_irg_ent (ir_graph *irg, entity *ent);
 
-int get_irg_params (ir_graph *irg);
-void set_irg_params (ir_graph *irg, int params);
-
-unsigned long get_irg_visited (ir_graph *irg);
-void set_irg_visited(ir_graph *irg, unsigned long i);
+/* 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);
 
 /* increments visited by one */
-void inc_irg_visited(ir_graph *irg);
-
-unsigned long get_irg_block_visited (ir_graph *irg);
-void set_irg_block_visited(ir_graph *irg, unsigned long i);
+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);
 
 /* increments block_visited by one */
-void inc_irg_block_visited(ir_graph *irg);
-
-int      get_params_of_irgraph (ir_graph *irg);
-void     set_params_of_irgraph (ir_graph *irg, int params);
+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_ */