From da426308276d234760971c54e3995bba4d15ad09 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christian=20W=C3=BCrdig?= Date: Tue, 16 Jan 2007 10:22:32 +0000 Subject: [PATCH] added flags and set/get functions indicating if we are in block walk or irg walk [r8527] --- ir/ir/irgraph.c | 30 ++++++++++++++++++++++++++++++ ir/ir/irgraph.h | 8 ++++++++ ir/ir/irgraph_t.h | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+) diff --git a/ir/ir/irgraph.c b/ir/ir/irgraph.c index 30876f5c5..157a5823c 100644 --- a/ir/ir/irgraph.c +++ b/ir/ir/irgraph.c @@ -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); diff --git a/ir/ir/irgraph.h b/ir/ir/irgraph.h index e5318a689..3b2f52acf 100644 --- a/ir/ir/irgraph.h +++ b/ir/ir/irgraph.h @@ -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); diff --git a/ir/ir/irgraph_t.h b/ir/ir/irgraph_t.h index f86e4b5cf..9171d4403 100644 --- a/ir/ir/irgraph_t.h +++ b/ir/ir/irgraph_t.h @@ -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) -- 2.20.1