used xmalloc instead of malloc
[libfirm] / ir / ir / irgraph_t.h
index 2d6482a..90af43e 100644 (file)
@@ -27,6 +27,7 @@
 #include "firm_common_t.h"
 #include "irtypeinfo.h"
 #include "irprog.h"
+#include "pseudo_irg.h"
 
 #include "irloop.h"
 
@@ -44,7 +45,7 @@ struct ir_graph {
                     the type of the procedure and the
                     class it belongs to. */
   struct type    *frame_type;    /**< A class type representing the stack frame.
-                                   Can include "inner" methods. */
+                    Can include "inner" methods. */
   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 */
@@ -54,11 +55,14 @@ struct ir_graph {
   struct ir_node *cstore;        /**< constant store -- no more needed!! */
   struct ir_node *frame;         /**< method's frame */
   struct ir_node *globals;       /**< pointer to the data segment containing all
-                                   globals as well as global procedures. */
+                    globals as well as global procedures. */
   struct ir_node *initial_mem;   /**< initial memory of this graph */
   struct ir_node *args;          /**< methods arguments */
+  struct ir_node **proj_args;          /**< projs off the methods arguments */
   struct ir_node *bad;           /**< bad node of this ir_graph, the one and
-                                   only in this graph */
+                    only in this graph */
+  struct ir_node *no_mem;        /**< NoMem node of this ir_graph, the one and
+                    only in this graph */
   /* GL removed: we need unknown with mode for analyses. */
   /*   struct ir_node *unknown;*/           /**< unknown node of this ir_graph */
   struct obstack *obst;          /**< obstack where all of the ir_nodes live */
@@ -80,11 +84,11 @@ struct ir_graph {
   struct Phi_in_stack *Phi_in_stack; /**< needed for automatic Phi construction */
 #endif
   int n_loc;                         /**< number of local variable in this
-                                       procedure including procedure parameters. */
+                    procedure including procedure parameters. */
 
   /* -- Fields for optimizations / analysis information -- */
   pset *value_table;                 /**< hash table for global value numbering (cse)
-                                       for optimizing use in iropt.c */
+                    for optimizing use in iropt.c */
   struct ir_node **outs;             /**< Space for the out arrays. */
 
 #ifdef DEBUG_libfirm
@@ -94,23 +98,23 @@ struct ir_graph {
   void *link;                        /**< A void* field to link any information to
                     the node. */
 
-  ir_graph **callers;                /**< For callgraph analyses. */
-  int       *caller_isbe;            /**< For callgraph analyses: set if backedge. */
-  ir_graph **callees;                /**< For callgraph analyses. */
-  int       *callee_isbe;            /**< For callgraph analyses: set if backedge. */
+  ir_graph **callers;                /**< For callgraph analysis. */
+  unsigned char *caller_isbe;        /**< For callgraph analysis: set if backedge. */
+  ir_graph **callees;                /**< For callgraph analysis. */
+  unsigned char *callee_isbe;        /**< For callgraph analysis: set if backedge. */
   int        callgraph_loop_depth;
   int        callgraph_recursion_depth;
   ir_loop   *l;
 
   /* -- Fields for Walking the graph -- */
   unsigned long visited;             /**< this flag is an identifier for
-                                       ir walk. it will be incremented
-                                       every time someone walks through
-                                       the graph */
+                    ir walk. it will be incremented
+                    every time someone walks through
+                    the graph */
   unsigned long block_visited;       /**< same as visited, for a complete block */
 #ifdef DEBUG_libfirm
   int graph_nr;             /**< a unique graph number for each graph to make output
-                              readable. */
+                   readable. */
 #endif
 };
 
@@ -119,6 +123,9 @@ struct ir_graph {
  */
 void init_irgraph(void);
 
+/* Internal constructor that does not add to irp_irgs or the like. */
+ir_graph *new_r_ir_graph (entity *ent, int n_loc);
+
 /** Make a rudimentary ir graph for the constant code.
    Must look like a correct irg, spare everything else. */
 ir_graph *new_const_code_irg(void);
@@ -260,6 +267,16 @@ __set_irg_args(ir_graph *irg, ir_node *node) {
   irg->args = node;
 }
 
+static INLINE ir_node **
+__get_irg_proj_args(const ir_graph *irg) {
+  return irg->proj_args;
+}
+
+static INLINE void
+__set_irg_proj_args(ir_graph *irg, ir_node **nodes) {
+  irg->proj_args = nodes;
+}
+
 static INLINE ir_node *
 __get_irg_bad(const ir_graph *irg) {
   return irg->bad;
@@ -270,6 +287,15 @@ __set_irg_bad(ir_graph *irg, ir_node *node) {
   irg->bad = node;
 }
 
+static INLINE ir_node *
+__get_irg_no_mem(const ir_graph *irg) {
+  return irg->no_mem;
+}
+
+static INLINE void
+__set_irg_no_mem(ir_graph *irg, ir_node *node) {
+  irg->no_mem = node;
+}
 static INLINE ir_node *
 __get_irg_current_block(const ir_graph *irg) {
   return irg->current_block;
@@ -440,6 +466,8 @@ __inc_irg_block_visited(ir_graph *irg) {
 #define set_irg_args(irg, node)            __set_irg_args(irg, node)
 #define get_irg_bad(irg)                   __get_irg_bad(irg)
 #define set_irg_bad(irg, node)             __set_irg_bad(irg, node)
+#define get_irg_no_mem(irg)                __get_irg_no_mem(irg)
+#define set_irg_no_mem(irg, node)          __set_irg_no_mem(irg, node)
 #define get_irg_current_block(irg)         __get_irg_current_block(irg)
 #define set_irg_current_block(irg, node)   __set_irg_current_block(irg, node)
 #define get_irg_entity(irg)                __get_irg_entity(irg)