Commit 3b7785f7 authored by Michael Beck's avatar Michael Beck
Browse files

Added a new attribute to block nodes: dead

This attribute can only be set, not reseted and means the block is dead
(could be replaced my Bad in old semantics).

the new is_Block_dead() test chescks for the new attribute (and is_Bad() too)
and should be used whenever a block is check with is_Bad()

[r4535]
parent d38b3755
......@@ -52,8 +52,9 @@ typedef struct Phi_in_stack Phi_in_stack;
*/
static default_initialize_local_variable_func_t *default_initialize_local_variable = NULL;
/*** ******************************************** */
/** privat interfaces, for professional use only */
/* -------------------------------------------- */
/* privat interfaces, for professional use only */
/* -------------------------------------------- */
/* Constructs a Block with a fixed number of predecessors.
Does not set current_block. Can not be used with automatic
......@@ -69,9 +70,10 @@ new_rd_Block (dbg_info* db, ir_graph *irg, int arity, ir_node **in)
/* res->attr.block.exc = exc_normal; */
/* res->attr.block.handler_entry = 0; */
res->attr.block.irg = irg;
res->attr.block.backedge = new_backedge_arr(irg->obst, arity);
res->attr.block.in_cg = NULL;
res->attr.block.dead = 0;
res->attr.block.irg = irg;
res->attr.block.backedge = new_backedge_arr(irg->obst, arity);
res->attr.block.in_cg = NULL;
res->attr.block.cg_backedge = NULL;
IRN_VRFY_IRG(res, irg);
......@@ -2373,12 +2375,13 @@ ir_node *new_d_immBlock (dbg_info* db) {
/* creates a new dynamic in-array as length of in is -1 */
res = new_ir_node (db, current_ir_graph, NULL, op_Block, mode_BB, -1, NULL);
current_ir_graph->current_block = res;
res->attr.block.matured = 0;
res->attr.block.matured = 0;
res->attr.block.dead = 0;
/* res->attr.block.exc = exc_normal; */
/* res->attr.block.handler_entry = 0; */
res->attr.block.irg = current_ir_graph;
res->attr.block.backedge = NULL;
res->attr.block.in_cg = NULL;
res->attr.block.irg = current_ir_graph;
res->attr.block.backedge = NULL;
res->attr.block.in_cg = NULL;
res->attr.block.cg_backedge = NULL;
set_Block_block_visited(res, 0);
......
......@@ -683,7 +683,10 @@ static void dump_node_vcgattr(FILE *F, ir_node *n, int bad)
fprintf (F, "color: blue");
break;
case iro_Block:
fprintf (F, "color: lightyellow");
if (is_Block_dead(n))
fprintf (F, "color: lightred");
else
fprintf (F, "color: lightyellow");
break;
case iro_Phi:
fprintf (F, "color: green");
......
......@@ -698,6 +698,14 @@ void remove_Block_cg_cfgpred_arr(ir_node * node) {
node->attr.block.in_cg = NULL;
}
ir_node *(set_Block_dead)(ir_node *block) {
return __set_Block_dead(block);
}
int (is_Block_dead)(const ir_node *block) {
return __is_Block_dead(block);
}
void
set_Start_irg(ir_node *node, ir_graph *irg) {
assert(node->op == op_Start);
......
......@@ -276,6 +276,9 @@ bool get_Block_matured (ir_node *node);
void set_Block_matured (ir_node *node, bool matured);
unsigned long get_Block_block_visited (ir_node *node);
void set_Block_block_visited (ir_node *node, unsigned long visit);
ir_node *set_Block_dead(ir_node *block);
int is_Block_dead(const ir_node *block);
/* For this current_ir_graph must be set. */
void mark_Block_block_visited(ir_node *node);
int Block_not_block_visited(ir_node *node);
......
......@@ -49,7 +49,8 @@ typedef struct {
ir_graph *irg;
unsigned long block_visited; /**< for the walker that walks over all blocks. */
/* Attributes private to construction: */
bool matured; /**< if set, all in-nodes of the block are fixed */
int matured:1; /**< if set, all in-nodes of the block are fixed */
int dead:1; /**< if set, the block is dead (and could be replace by a Bad */
struct ir_node **graph_arr; /**< array to store all parameters */
/* Attributes holding analyses information */
struct dom_info dom; /**< Datastructure that holds information about dominators.
......@@ -510,6 +511,25 @@ __is_Block(const ir_node *node) {
return (__get_irn_op(node) == op_Block);
}
static INLINE ir_node *
__set_Block_dead(ir_node *block) {
assert(__get_irn_op(block) == op_Block);
block->attr.block.dead = 1;
return block;
}
static INLINE int
__is_Block_dead(const ir_node *block) {
ir_op * op = __get_irn_op(block);
if (op == op_Bad)
return 1;
else {
assert(op == op_Block);
return block->attr.block.dead;
}
}
/* this section MUST contain all inline functions */
#define is_ir_node(thing) __is_ir_node(thing)
#define get_irn_intra_arity(node) __get_irn_intra_arity(node)
......@@ -534,5 +554,7 @@ __is_Block(const ir_node *node) {
#define is_Bad(node) __is_Bad(node)
#define is_no_Block(node) __is_no_Block(node)
#define is_Block(node) __is_Block(node)
#define set_Block_dead(block) __set_Block_dead(block)
#define is_Block_dead(block) __is_Block_dead(block)
# endif /* _IRNODE_T_H_ */
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