Commit 41eca21e authored by Michael Beck's avatar Michael Beck
Browse files

- IR nodes now have node numbers in RELEASE mode, this fixes problems in backend

  and seems generally to be a good idea

[r25572]
parent ea628f31
......@@ -1483,9 +1483,7 @@ static ir_node *gen_Proj(ir_node *node) {
ir_node *block = be_transform_node(get_nodes_block(node));
ir_node *new_proj = new_r_Proj(irg, block, new_pred, mode_Iu,
get_Proj_proj(node));
#ifdef DEBUG_libfirm
new_proj->node_nr = node->node_nr;
#endif
return new_proj;
}
}
......
......@@ -121,10 +121,7 @@ ir_node *be_duplicate_node(ir_node *node) {
copy_node_attr(node, new_node);
be_duplicate_deps(node, new_node);
#ifdef DEBUG_libfirm
new_node->node_nr = node->node_nr;
#endif
return new_node;
}
......@@ -346,9 +343,8 @@ static ir_node *gen_Block(ir_node *node) {
block = new_ir_node(dbgi, irg, NULL, get_irn_op(node), get_irn_mode(node),
get_irn_arity(node), get_irn_in(node) + 1);
copy_node_attr(node, block);
#ifdef DEBUG_libfirm
block->node_nr = node->node_nr;
#endif
if (node == macroblock) {
/* this node is a macroblock header */
set_Block_MacroBlock(block, block);
......
......@@ -5402,9 +5402,7 @@ static ir_node *gen_Proj(ir_node *node)
ir_node *block = be_transform_node(get_nodes_block(node));
ir_node *new_proj = new_r_Proj(current_ir_graph, block, new_pred,
mode_Iu, get_Proj_proj(node));
#ifdef DEBUG_libfirm
new_proj->node_nr = node->node_nr;
#endif
return new_proj;
}
}
......
......@@ -40,11 +40,7 @@ static ir_lnk_nodemap_entry_t null_nodemap_entry;
#define ConstKeyType const ir_node*
#define GetKey(value) (value).node
#define InitData(self,value,key) do { (value).node = (key); (value).list.next = NULL; (value).list.prev = NULL; } while(0)
#ifdef DEBUG_libfirm
#define Hash(self,key) ((unsigned)((key)->node_nr))
#else
#define Hash(self,key) HASH_PTR(key)
#endif
#define KeysEqual(self,key1,key2) (key1) == (key2)
#define SetRangeEmpty(ptr,size) memset(ptr, 0, (size) * sizeof((ptr)[0]))
#define EntrySetEmpty(value) (value).node = NULL
......
......@@ -40,11 +40,7 @@ static ir_lnk_nodeset_entry_t null_nodeset_entry;
#define ConstKeyType const ir_node*
#define GetKey(value) (value).node
#define InitData(self,value,key) do { (value).node = (key); (value).list.next = NULL; (value).list.prev = NULL; } while(0)
#ifdef DEBUG_libfirm
#define Hash(self,key) ((unsigned)((key)->node_nr))
#else
#define Hash(self,key) HASH_PTR(key)
#endif
#define KeysEqual(self,key1,key2) (key1) == (key2)
#define SetRangeEmpty(ptr,size) memset(ptr, 0, (size) * sizeof((ptr)[0]))
#define EntrySetEmpty(value) (value).node = NULL
......
......@@ -163,13 +163,10 @@ new_ir_node(dbg_info *db, ir_graph *irg, ir_node *block, ir_op *op, ir_mode *mod
memcpy(&res->in[1], in, sizeof(ir_node *) * arity);
}
res->in[0] = block;
res->in[0] = block;
set_irn_dbg_info(res, db);
res->out = NULL;
#ifdef DEBUG_libfirm
res->out = NULL;
res->node_nr = get_irp_new_node_nr();
#endif
for (i = 0; i < EDGE_KIND_LAST; ++i)
INIT_LIST_HEAD(&res->edge_info[i].outs_head);
......@@ -497,11 +494,7 @@ void set_irn_pinned(ir_node *node, op_pin_state state) {
/* Outputs a unique number for this node */
long get_irn_node_nr(const ir_node *node) {
assert(node);
#ifdef DEBUG_libfirm
return node->node_nr;
#else
return (long)PTR_TO_INT(node);
#endif
}
const_attr *get_irn_const_attr(ir_node *node) {
......
......@@ -42,11 +42,7 @@ static ir_nodemap_entry_t null_nodemap_entry = { NULL, NULL };
#define ConstKeyType const ir_node*
#define GetKey(value) (value).node
#define InitData(self,value,key) (value).node = (key)
#ifdef DEBUG_libfirm
#define Hash(self,key) ((unsigned)((key)->node_nr))
#else
#define Hash(self,key) HASH_PTR(key)
#endif
#define KeysEqual(self,key1,key2) (key1) == (key2)
#define SetRangeEmpty(ptr,size) memset(ptr, 0, (size) * sizeof((ptr)[0]))
#define EntrySetEmpty(value) (value).node = NULL
......
......@@ -38,11 +38,7 @@
#define ValueType ir_node*
#define NullValue NULL
#define DeletedValue ((ir_node*)-1)
#ifdef DEBUG_libfirm
#define Hash(this,key) ((unsigned)((key)->node_nr))
#else
#define Hash(this,key) HASH_PTR(key)
#endif
#define KeysEqual(this,key1,key2) (key1) == (key2)
#define SetRangeEmpty(ptr,size) memset(ptr, 0, (size) * sizeof((ptr)[0]))
......
......@@ -61,10 +61,7 @@ static ir_prog *new_incomplete_ir_prog(void)
res->last_region_nr = 0;
res->last_label_nr = 1; /* 0 is reserved as non-label */
res->max_irg_idx = 0;
#ifdef DEBUG_libfirm
res->max_node_nr = 0;
#endif
#ifndef NDEBUG
res->reserved_resources = 0;
#endif
......
......@@ -118,14 +118,12 @@ _get_irp_opcode(int pos) {
return irp->opcodes[pos];
}
#ifdef DEBUG_libfirm
/** Returns a new, unique number to number nodes or the like. */
static inline long
get_irp_new_node_nr(void) {
assert(irp);
return irp->max_node_nr++;
}
#endif /* DEBUG_libfirm */
static inline int
get_irp_new_irg_idx(void) {
......
......@@ -366,6 +366,7 @@ struct ir_node {
void *link; /**< To attach additional information to the node, e.g.
used during optimization to link to nodes that
shall replace a node. */
long node_nr; /**< A globally unique node number for each node. */
/* ------- Fields for optimizations / analysis information ------- */
ir_def_use_edge *out; /**< array of def-use edges. */
struct dbg_info *dbi; /**< A pointer to information for debug support. */
......@@ -373,8 +374,6 @@ struct ir_node {
#ifdef DEBUG_libfirm
unsigned out_valid : 1;
unsigned flags : 31;
long node_nr; /**< A unique node number for each node to make output
readable. */
#endif
/* ------- For analyses -------- */
ir_loop *loop; /**< the loop the node is in. Access routines in irloop.h */
......@@ -567,9 +566,7 @@ struct ir_prog {
ir_exc_region_t last_region_nr; /**< The last exception region number that was assigned. */
ir_label_t last_label_nr; /**< The highest label number for generating unique labels. */
int max_irg_idx; /**< highest unused irg index */
#ifdef DEBUG_libfirm
long max_node_nr; /**< to generate unique numbers for nodes. */
#endif
#ifndef NDEBUG
ir_resources_t reserved_resources; /**< Bitset for tracking used global resources. */
#endif
......
......@@ -164,15 +164,10 @@ static void copy_node(ir_node *n, void *env) {
}
copy_node_attr(n, nn);
#ifdef DEBUG_libfirm
{
int copy_node_nr = env != NULL;
if (copy_node_nr) {
/* for easier debugging, we want to copy the node numbers too */
nn->node_nr = n->node_nr;
}
if (env != NULL) {
/* for easier debugging, we want to copy the node numbers too */
nn->node_nr = n->node_nr;
}
#endif
set_new_node(n, nn);
hook_dead_node_elim_subst(current_ir_graph, n, nn);
......
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