added flags and set/get functions indicating if we are in block walk or irg walk
authorChristian Würdig <chriswue@ipd.info.uni-karlsruhe.de>
Tue, 16 Jan 2007 10:22:32 +0000 (10:22 +0000)
committerChristian Würdig <chriswue@ipd.info.uni-karlsruhe.de>
Tue, 16 Jan 2007 10:22:32 +0000 (10:22 +0000)
[r8527]

ir/ir/irgraph.c
ir/ir/irgraph.h
ir/ir/irgraph_t.h

index 30876f5..157a582 100644 (file)
@@ -873,6 +873,36 @@ void *get_irg_loc_description(ir_graph *irg, int n) {
   return irg->loc_descriptions ? irg->loc_descriptions[n] : NULL;
 }
 
+/* Sets the inside block walk flag */
+void (set_inside_block_walk)(ir_graph *irg) {
+  _set_inside_block_walk(irg);
+}
+
+/* Clears the inside block walk flag */
+void (clear_inside_block_walk)(ir_graph *irg) {
+  _clear_inside_block_walk(irg);
+}
+
+/* Returns the inside block walk flag */
+unsigned (inside_block_walk)(const ir_graph *irg) {
+  return _inside_block_walk(irg);
+}
+
+/* Sets the inside irg walk flag */
+void (set_inside_irg_walk)(ir_graph *irg) {
+  _clear_inside_irg_walk(irg);
+}
+
+/* Clears the inside irg walk flag */
+void (clear_inside_irg_walk)(ir_graph *irg) {
+  _clear_inside_irg_walk(irg);
+}
+
+/* Returns the inside irg walk flag */
+unsigned (inside_irg_walk)(const ir_graph *irg) {
+  return _inside_irg_walk(irg);
+}
+
 /* Returns a estimated node count of the irg. */
 unsigned (get_irg_estimated_node_cnt)(const ir_graph *irg) {
   return _get_irg_estimated_node_cnt(irg);
index e5318a6..3b2f52a 100644 (file)
@@ -478,6 +478,14 @@ void          inc_irg_block_visited (ir_graph *irg);
 unsigned long get_irg_block_visited (const ir_graph *irg);
 void          set_irg_block_visited (ir_graph *irg, unsigned long i);
 
+/** Flags indicating whether or not we are inside an irg/block walk. */
+void     set_inside_block_walk(ir_graph *irg);
+void     clear_inside_block_walk(ir_graph *irg);
+unsigned inside_block_walk(const ir_graph *irg);
+void     set_inside_irg_walk(ir_graph *irg);
+void     clear_inside_irg_walk(ir_graph *irg);
+unsigned inside_irg_walk(const ir_graph *irg);
+
 /** move Proj nodes into the same block as its predecessors */
 void normalize_proj_nodes(ir_graph *irg);
 
index f86e4b5..9171d44 100644 (file)
@@ -148,6 +148,8 @@ struct ir_graph {
                     every time someone walks through
                     the graph */
   unsigned long block_visited;       /**< same as visited, for a complete block */
+  unsigned inside_irg_walk   : 1;    /**< set to 1 if we are currently in an irg walk */
+  unsigned inside_block_walk : 1;    /**< set to 1 if we are currently in a block walk */
   unsigned estimated_node_count;     /**< estimated number of nodes in this graph,
                                           updated after every walk */
   irg_edges_info_t edge_info;        /**< edge info for automatic outs */
@@ -548,6 +550,36 @@ _dec_irg_block_visited(ir_graph *irg) {
   --irg->block_visited;
 }
 
+static INLINE void
+_set_inside_block_walk(ir_graph *irg) {
+  irg->inside_block_walk = 1;
+}
+
+static INLINE void
+_clear_inside_block_walk(ir_graph *irg) {
+  irg->inside_block_walk = 0;
+}
+
+static INLINE unsigned
+_inside_block_walk(const ir_graph *irg) {
+  return irg->inside_block_walk;
+}
+
+static INLINE void
+_set_inside_irg_walk(ir_graph *irg) {
+  irg->inside_irg_walk = 1;
+}
+
+static INLINE void
+_clear_inside_irg_walk(ir_graph *irg) {
+  irg->inside_irg_walk = 0;
+}
+
+static INLINE unsigned
+_inside_irg_walk(const ir_graph *irg) {
+  return irg->inside_irg_walk;
+}
+
 static INLINE unsigned
 _get_irg_estimated_node_cnt(const ir_graph *irg) {
   return irg->estimated_node_count;
@@ -665,6 +697,12 @@ get_idx_irn(ir_graph *irg, unsigned idx) {
 #define set_irg_block_visited(irg, v)         _set_irg_block_visited(irg, v)
 #define inc_irg_block_visited(irg)            _inc_irg_block_visited(irg)
 #define dec_irg_block_visited(irg)            _dec_irg_block_visited(irg)
+#define set_inside_block_walk(irg)            _set_inside_block_walk(irg)
+#define clear_inside_block_walk(irg)          _clear_inside_block_walk(irg)
+#define inside_block_walk(irg)                _inside_block_walk(irg)
+#define set_inside_irg_walk(irg)              _set_inside_irg_walk(irg)
+#define clear_inside_irg_walk(irg)            _clear_inside_irg_walk(irg)
+#define inside_irg_walk(irg)                  _inside_irg_walk(irg)
 #define get_irg_estimated_node_cnt(irg)       _get_irg_estimated_node_cnt(irg)
 #define get_irg_fp_model(irg)                 _get_irg_fp_model(irg)