vrfy_entities = enable;
}
+#ifndef NDEBUG
+
/**
* little helper for NULL modes
*/
get_irn_node_nr(block), get_irn_arity(block));
}
+#endif /* #ifndef NDEBUG */
+
/** If the address is Sel or SymConst, return the entity. */
static ir_entity *get_ptr_entity(ir_node *ptr) {
if (get_irn_op(ptr) == op_Sel) {
*/
static int verify_node_Block(ir_node *n, ir_graph *irg) {
int i;
+ ir_node *mb = get_Block_MacroBlock(n);
+
+ ASSERT_AND_RET(is_Block(mb) || is_Bad(mb), "Block node with wrong MacroBlock", 0);
+
+ if (is_Block(mb) && mb != n) {
+ /* Blocks with more than one predecessor must be header blocks */
+ ASSERT_AND_RET(get_Block_n_cfgpreds(n) == 1, "partBlock with more than one predecessor", 0);
+ }
for (i = get_Block_n_cfgpreds(n) - 1; i >= 0; --i) {
ir_node *pred = get_Block_cfgpred(n, i);
"Block node", 0);
}
- /* End block may only have Return, Raise or fragile ops as preds. */
if (n == get_irg_end_block(irg) && get_irg_phase_state(irg) != phase_backend)
+ /* End block may only have Return, Raise or fragile ops as preds. */
for (i = get_Block_n_cfgpreds(n) - 1; i >= 0; --i) {
ir_node *pred = skip_Proj(get_Block_cfgpred(n, i));
- if (is_Proj(pred) || get_irn_op(pred) == op_Tuple)
+ if (is_Proj(pred) || is_Tuple(pred))
break; /* We can not test properly. How many tuples are there? */
ASSERT_AND_RET(
(
- is_Return(pred) ||
- is_Bad(pred) ||
- (get_irn_op(pred) == op_Raise) ||
+ is_Return(pred) ||
+ is_Bad(pred) ||
+ is_Raise(pred) ||
is_fragile_op(pred)
),
"End Block node", 0);
* @return non-zero on success, 0 on dominance error
*/
static int check_dominance_for_node(ir_node *use) {
+ if (is_Block(use)) {
+ ir_node *mbh = get_Block_MacroBlock(use);
+
+ if (mbh != use) {
+ /* must be a partBlock */
+ if (is_Block(mbh)) {
+ ASSERT_AND_RET(block_dominates(mbh, use), "MacroBlock header must dominate a partBlock", 0);
+ }
+ }
+ }
/* This won't work for blocks and the end node */
- if (!is_Block(use) && use != get_irg_end(current_ir_graph) && use != current_ir_graph->anchor) {
+ else if (use != get_irg_end(current_ir_graph) && use != current_ir_graph->anchor) {
int i;
ir_node *bl = get_nodes_block(use);
}
int irn_vrfy(ir_node *n) {
- int res = 1;
#ifdef DEBUG_libfirm
- res = irn_vrfy_irg(n, current_ir_graph);
+ return irn_vrfy_irg(n, current_ir_graph);
+#else
+ (void)n;
+ return 1;
#endif
- return res;
}
/*-----------------------------------------------------------------*/
else
fprintf(stderr, "irg_verify: Verifying graph %p failed\n", (void *)current_ir_graph);
}
+#else
+ (void)irg;
+ (void)flags;
#endif /* DEBUG_libfirm */
return res;
fprintf(stderr, "irg_vrfy_bads: Block %ld has Bad predecessor\n", get_irn_node_nr(node));
}
if (get_node_verification_mode() == FIRM_VERIFICATION_ON) {
- dump_ir_block_graph(current_ir_graph, "-assert");
+ dump_ir_block_graph_sched(current_ir_graph, "-assert");
assert(0 && "Bad CF detected");
}
}
fprintf(stderr, "irg_vrfy_bads: node %ld has Bad Block\n", get_irn_node_nr(node));
}
if (get_node_verification_mode() == FIRM_VERIFICATION_ON) {
- dump_ir_block_graph(current_ir_graph, "-assert");
+ dump_ir_block_graph_sched(current_ir_graph, "-assert");
assert(0 && "Bad CF detected");
}
}
fprintf(stderr, "irg_vrfy_bads: node %ld is a Tuple\n", get_irn_node_nr(node));
}
if (get_node_verification_mode() == FIRM_VERIFICATION_ON) {
- dump_ir_block_graph(current_ir_graph, "-assert");
+ dump_ir_block_graph_sched(current_ir_graph, "-assert");
assert(0 && "Tuple detected");
}
}
fprintf(stderr, "irg_vrfy_bads: Phi %ld has Bad Input\n", get_irn_node_nr(node));
}
if (get_node_verification_mode() == FIRM_VERIFICATION_ON) {
- dump_ir_block_graph(current_ir_graph, "-assert");
+ dump_ir_block_graph_sched(current_ir_graph, "-assert");
assert(0 && "Bad CF detected");
}
}
fprintf(stderr, "irg_vrfy_bads: node %ld has Bad Input\n", get_irn_node_nr(node));
}
if (get_node_verification_mode() == FIRM_VERIFICATION_ON) {
- dump_ir_block_graph(current_ir_graph, "-assert");
+ dump_ir_block_graph_sched(current_ir_graph, "-assert");
assert(0 && "Bad NON-CF detected");
}
}