# include "irgraph_t.h"
# include "irvrfy.h"
# include "irgwalk.h"
+# include "irdump.h"
#ifdef NDEBUG
/*
#else
#define ASSERT_AND_RET(expr, string, ret) \
do { \
- if (opt_do_node_verification == NODE_VERIFICATION_ON) \
- assert((expr) && string); \
+ if (opt_do_node_verification == NODE_VERIFICATION_ON) {\
+ if (!(expr)) dump_ir_block_graph(current_ir_graph, "-assert"); \
+ assert((expr) && string); } \
if (!(expr)) { \
if (opt_do_node_verification == NODE_VERIFICATION_REPORT) \
fprintf(stderr, #expr " : " string "\n"); \
get_irn_node_nr(pred), get_mode_name_ex(get_irn_mode(pred)));
}
+/**
+ * Show Phi inputs
+ */
+static void show_phi_inputs(ir_node *phi, ir_node *block)
+{
+ fprintf(stderr, "\nFIRM: irn_vrfy_irg() Phi node %ld has %d inputs, its Block %ld has %d\n",
+ get_irn_node_nr(phi), get_irn_arity(phi),
+ get_irn_node_nr(block), get_irn_arity(block));
+}
+
/**
* verify the Proj number
*/
opcode = get_irn_opcode(n);
- /* We don't want to test nodes whose predecessors are Bad or Unknown,
+ /* We don't want to test nodes whose predecessors are Bad,
as we would have to special case that for each operation. */
if (opcode != iro_Phi && opcode != iro_Block)
for (i = 0; i < get_irn_arity(n); i++) {
opcode1 = get_irn_opcode(get_irn_n(n, i));
- if (opcode1 == iro_Bad /*|| opcode1 == iro_Unknown*/) /* GL: for analyses mode must be correct. */
+ if (opcode1 == iro_Bad)
return 1;
}
);
break;
- case iro_Const: {
- tarval *tv = get_Const_tarval(n);
- ASSERT_AND_RET(
- /* Const: BB --> data */
- (mode_is_data (mymode) ||
- mymode == mode_b) /* we want boolean constants for static evaluation */
- ,"Const node", 0 /* of Cmp. */
- );
- } break;
-
+ case iro_Const: {
+ ASSERT_AND_RET(
+ /* Const: BB --> data */
+ (mode_is_data (mymode) ||
+ mymode == mode_b) /* we want boolean constants for static evaluation */
+ ,"Const node", 0 /* of Cmp. */
+ );
+ } break;
case iro_SymConst:
if (get_SymConst_kind(n) == symconst_addr_ent) {
entity *ent = get_SymConst_entity(n);
if (is_method_type(get_entity_type(ent)) &&
get_irn_irg(n) != get_const_code_irg()) {
-#if 0
+#if 1
ASSERT_AND_RET((get_entity_peculiarity(ent) != peculiarity_description),
"A constant must address an existing method.", 0);
#endif
op1mode = get_irn_mode(in[1]);
ASSERT_AND_RET_DBG(
/* Minus: BB x float --> float */
- op1mode == mymode && get_mode_sort(op1mode) == irms_float_number, "Minus node", 0,
+ op1mode == mymode && mode_is_float(op1mode), "Minus node", 0,
show_unop_failure(n , "/* Minus: BB x float --> float */");
);
op_is_symmetric = 2;
break;
case iro_Phi:
+ {
+ ir_node *block = get_nodes_block(n);
+
+ if (! is_Bad(block) && get_irg_phase_state(get_irn_irg(n)) != phase_building) {
+ /* a Phi node MUST have the same number of inputs as its block */
+ ASSERT_AND_RET_DBG(
+ get_irn_arity(n) == get_irn_arity(block),
+ "wrong number of inputs in Phi node", 0,
+ show_phi_inputs(n, block);
+ );
+ }
+
/* Phi: BB x dataM^n --> dataM */
for (i = 1; i < get_irn_arity(n); i++) {
if (!is_Bad(in[i]) && (get_irn_op(in[i]) != op_Unknown))
};
ASSERT_AND_RET( mode_is_dataM(mymode), "Phi node", 0 );
break;
-
+ }
case iro_Load:
op1mode = get_irn_mode(in[1]);
op2mode = get_irn_mode(in[2]);