Commit afc76013 authored by Michael Beck's avatar Michael Beck
Browse files

add *_Block_mark() api to mark easily Blocks in the graph

[r19773]
parent a423b8b8
......@@ -521,16 +521,22 @@ int using_irn_visited(const ir_graph *irg);
void set_using_irn_link(ir_graph *irg);
void clear_using_irn_link(ir_graph *irg);
int using_irn_link(const ir_graph *irg);
void set_using_block_mark(ir_graph *irg);
void clear_using_block_mark(ir_graph *irg);
int using_block_mark(const ir_graph *irg);
#else
static INLINE void set_using_block_visited(ir_graph *irg) { (void) irg; }
static INLINE void clear_using_block_visited(ir_graph *irg) { (void) irg; }
static INLINE int using_block_visited(const ir_graph *irg) { (void) irg; return 0; }
static INLINE void set_using_irn_visited(ir_graph *irg) { (void) irg; }
static INLINE void clear_using_irn_visited(ir_graph *irg) { (void) irg; }
static INLINE int using_irn_visited(const ir_graph *irg) { (void) irg; return 0; }
static INLINE void set_using_irn_link(ir_graph *irg) { (void) irg; }
static INLINE void clear_using_irn_link(ir_graph *irg) { (void) irg; }
static INLINE int using_irn_link(const ir_graph *irg) { (void) irg; return 0; }
#define set_using_block_visited(irg)
#define clear_using_block_visited(irg)
#define using_block_visited(irg) 0
#define set_using_irn_visited(irg)
#define clear_using_irn_visited(irg)
#define using_irn_visited(irg) 0
#define set_using_irn_link(irg)
#define clear_using_irn_link(irg)
#define using_irn_link(irg) 0
#define set_using_block_mark(irg)
#define clear_using_block_mark(irg)
#define using_block_mark(irg) 0
#endif
/** Normalization: Move Proj nodes into the same block as its predecessors */
......
......@@ -1084,7 +1084,21 @@ void clear_using_irn_link(ir_graph *irg) {
int using_irn_link(const ir_graph *irg) {
return irg->using_irn_link;
}
#endif
void set_using_block_mark(ir_graph *irg) {
assert(irg->using_block_mark == 0);
irg->using_block_mark = 1;
}
void clear_using_block_mark(ir_graph *irg) {
assert(irg->using_block_mark == 1);
irg->using_block_mark = 0;
}
int using_block_mark(const ir_graph *irg) {
return irg->using_block_mark;
}
#endif /* NDEBUG */
/* Returns a estimated node count of the irg. */
unsigned (get_irg_estimated_node_cnt)(const ir_graph *irg) {
......
......@@ -959,6 +959,19 @@ _add_Block_phi(ir_node *block, ir_node *phi) {
_set_Block_phis(block, phi);
}
/** Get the Block mark (single bit). */
static INLINE unsigned
_get_Block_mark(const ir_node *block) {
assert(_is_Block(block));
return block->attr.block.marked;
}
/** Set the Block mark (single bit). */
static INLINE void
_set_Block_mark(ir_node *block, unsigned mark) {
assert(_is_Block(block));
block->attr.block.marked = mark;
}
/* this section MUST contain all inline functions */
#define is_ir_node(thing) _is_ir_node(thing)
......@@ -1080,7 +1093,9 @@ _add_Block_phi(ir_node *block, ir_node *phi) {
#define set_Block_phis(block, phi) _set_Block_phis(block, phi)
#define get_Block_phis(block) _get_Block_phis(block)
#define add_Block_phi(block, phi) _add_block_phi(block, phi)
#define add_Block_phi(block, phi) _add_Block_phi(block, phi)
#define get_Block_mark(block) _get_Block_mark(block)
#define set_Block_mark(block, mark) _set_Block_mark(block, mark)
#define set_Phi_next(node, phi) _set_Phi_next(node, phi)
#define get_Phi_next(node) _get_Phi_next(node)
......
......@@ -126,6 +126,7 @@ typedef struct {
unsigned is_dead:1; /**< If set, the block is dead (and could be replace by a Bad. */
unsigned is_mb_head:1; /**< Set if this block is a macroblock head. */
unsigned has_label:1; /**< Set if this block has a label assigned. */
unsigned marked:1; /**< Can be set/unset to temporary mark a block. */
ir_node **graph_arr; /**< An array to store all parameters. */
/* Attributes holding analyses information */
ir_dom_info dom; /**< Datastructure that holds information about dominators.
......@@ -502,6 +503,7 @@ struct ir_graph {
unsigned using_irn_visited : 1; /**< set to 1 if we are currently using the visited flag */
unsigned using_block_visited : 1; /**< set to 1 if we are currently using the block_visited flag */
unsigned using_irn_link : 1; /**< set to 1 if we are currently using the irn_link fields */
unsigned using_block_mark : 1; /**< set to 1 if we are currently using the block mark flags */
#endif
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment