+ get_Call_n_params(n) == get_method_n_params(mt),
+ "Number of args for Call doesn't match number of args in non variadic type.",
+ 0);
+ }
+
+ for (i = 0; i < get_method_n_params(mt); i++) {
+ ir_type *t = get_method_param_type(mt, i);
+
+ if (is_atomic_type(t)) {
+ ASSERT_AND_RET_DBG(
+ get_irn_mode(get_Call_param(n, i)) == get_type_mode(t),
+ "Mode of arg for Call doesn't match mode of arg type.", 0,
+ show_call_param(n, mt);
+ );
+ }
+ else {
+ /* call with a compound type, mode must be reference */
+ ASSERT_AND_RET_DBG(
+ mode_is_reference(get_irn_mode(get_Call_param(n, i))),
+ "Mode of arg for Call doesn't match mode of arg type.", 0,
+ show_call_param(n, mt);
+ );
+ }
+ }
+
+#if 0
+ if (Call_has_callees(n)) {
+ for (i = 0; i < get_Call_n_callees(n); i++) {
+ ASSERT_AND_RET(is_entity(get_Call_callee(n, i)), "callee array must contain entities.", 0);
+ }
+ }
+#endif
+ return 1;
+}
+
+/**
+ * verify an Add node
+ */
+static int verify_node_Add(ir_node *n, ir_graph *irg) {
+ ir_mode *mymode = get_irn_mode(n);
+ ir_mode *op1mode = get_irn_mode(get_Add_left(n));
+ ir_mode *op2mode = get_irn_mode(get_Add_right(n));
+
+ ASSERT_AND_RET_DBG(
+ (
+ /* common Add: BB x numP x numP --> numP */
+ (op1mode == mymode && op2mode == op1mode && mode_is_numP(mymode)) ||
+ /* Pointer Add: BB x ref x int --> ref */
+ (mode_is_reference(op1mode) && mode_is_int(op2mode) && op1mode == mymode) ||
+ /* Pointer Add: BB x int x ref --> ref */
+ (mode_is_int(op1mode) && op2mode == mymode && mode_is_reference(mymode))
+ ),
+ "Add node", 0,
+ show_binop_failure(n, "/* common Add: BB x numP x numP --> numP */ |\n"
+ "/* Pointer Add: BB x ref x int --> ref */ |\n"
+ "/* Pointer Add: BB x int x ref --> ref */");
+ );
+ return 1;
+}
+
+/**
+ * verify a Sub node
+ */
+static int verify_node_Sub(ir_node *n, ir_graph *irg) {
+ ir_mode *mymode = get_irn_mode(n);
+ ir_mode *op1mode = get_irn_mode(get_Sub_left(n));
+ ir_mode *op2mode = get_irn_mode(get_Sub_right(n));
+
+ ASSERT_AND_RET_DBG(
+ /* common Sub: BB x numP x numP --> numP */
+ ((mymode ==op1mode && mymode == op2mode && mode_is_numP(op1mode)) ||
+ /* Pointer Sub: BB x ref x int --> ref */
+ (op1mode == mymode && mode_is_int(op2mode) && mode_is_reference(mymode)) ||
+ /* Pointer Sub: BB x int x ref --> ref */
+ (mode_is_int(op1mode) && op2mode == mymode && mode_is_reference(mymode)) ||
+ /* Pointer Sub: BB x ref x ref --> int */
+ (op1mode == op2mode && mode_is_reference(op2mode) && mode_is_int(mymode))),
+ "Sub node", 0,
+ show_binop_failure(n, "/* common Sub: BB x numP x numP --> numP */ |\n"
+ "/* Pointer Sub: BB x ref x int --> ref */ |\n"
+ "/* Pointer Sub: BB x int x ref --> ref */ |\n"
+ "/* Pointer Sub: BB x ref x ref --> int */" );
+ );
+ return 1;
+}
+
+/**
+ * verify a Minus node
+ */
+static int verify_node_Minus(ir_node *n, ir_graph *irg) {
+ ir_mode *mymode = get_irn_mode(n);
+ ir_mode *op1mode = get_irn_mode(get_Minus_op(n));
+
+ ASSERT_AND_RET_DBG(
+ /* Minus: BB x num --> num */
+ op1mode == mymode && mode_is_num(op1mode), "Minus node", 0,
+ show_unop_failure(n , "/* Minus: BB x num --> num */");
+ );
+ return 1;
+}
+
+/**
+ * verify a Mul node
+ */
+static int verify_node_Mul(ir_node *n, ir_graph *irg) {
+ ir_mode *mymode = get_irn_mode(n);
+ ir_mode *op1mode = get_irn_mode(get_Mul_left(n));
+ ir_mode *op2mode = get_irn_mode(get_Mul_right(n));
+
+ ASSERT_AND_RET_DBG(
+ /* Mul: BB x int1 x int1 --> int2 */
+ ((mode_is_int(op1mode) && op2mode == op1mode && mode_is_int(mymode)) ||
+ /* Mul: BB x float x float --> float */
+ (mode_is_float(op1mode) && op2mode == op1mode && mymode == op1mode)),
+ "Mul node",0,
+ show_binop_failure(n, "/* Mul: BB x int1 x int1 --> int2 */ |\n"
+ "/* Mul: BB x float x float --> float */");
+ );
+ return 1;
+}
+
+/**
+ * verify a Quot node
+ */
+static int verify_node_Quot(ir_node *n, ir_graph *irg) {
+ ir_mode *mymode = get_irn_mode(n);
+ ir_mode *op1mode = get_irn_mode(get_Quot_mem(n));
+ ir_mode *op2mode = get_irn_mode(get_Quot_left(n));
+ ir_mode *op3mode = get_irn_mode(get_Quot_right(n));
+
+ ASSERT_AND_RET_DBG(
+ /* Quot: BB x M x float x float --> M x X x float */
+ op1mode == mode_M && op2mode == op3mode &&
+ get_mode_sort(op2mode) == irms_float_number &&
+ mymode == mode_T,
+ "Quot node",0,
+ show_binop_failure(n, "/* Quot: BB x M x float x float --> M x X x float */");
+ );
+ return 1;
+}
+
+/**
+ * verify a DivMod node
+ */
+static int verify_node_DivMod(ir_node *n, ir_graph *irg) {
+ ir_mode *mymode = get_irn_mode(n);
+ ir_mode *op1mode = get_irn_mode(get_DivMod_mem(n));
+ ir_mode *op2mode = get_irn_mode(get_DivMod_left(n));
+ ir_mode *op3mode = get_irn_mode(get_DivMod_right(n));
+
+ ASSERT_AND_RET(
+ /* DivMod: BB x M x int x int --> M x X x int x int */
+ op1mode == mode_M &&
+ mode_is_int(op2mode) &&
+ op3mode == op2mode &&
+ mymode == mode_T,
+ "DivMod node", 0
+ );
+ return 1;
+}
+
+/**
+ * verify a Div node
+ */
+static int verify_node_Div(ir_node *n, ir_graph *irg) {
+ ir_mode *mymode = get_irn_mode(n);
+ ir_mode *op1mode = get_irn_mode(get_Div_mem(n));
+ ir_mode *op2mode = get_irn_mode(get_Div_left(n));
+ ir_mode *op3mode = get_irn_mode(get_Div_right(n));
+
+ ASSERT_AND_RET(
+ /* Div: BB x M x int x int --> M x X x int */
+ op1mode == mode_M &&
+ op2mode == op3mode &&
+ mode_is_int(op2mode) &&
+ mymode == mode_T,
+ "Div node", 0
+ );
+ return 1;
+}
+
+/**
+ * verify a Mod node
+ */
+static int verify_node_Mod(ir_node *n, ir_graph *irg) {
+ ir_mode *mymode = get_irn_mode(n);
+ ir_mode *op1mode = get_irn_mode(get_Mod_mem(n));
+ ir_mode *op2mode = get_irn_mode(get_Mod_left(n));
+ ir_mode *op3mode = get_irn_mode(get_Mod_right(n));
+
+ ASSERT_AND_RET(
+ /* Mod: BB x M x int x int --> M x X x int */
+ op1mode == mode_M &&
+ op2mode == op3mode &&
+ mode_is_int(op2mode) &&
+ mymode == mode_T,
+ "Mod node", 0
+ );
+ return 1;
+}
+
+/**
+ * verify an Abs node
+ */
+static int verify_node_Abs(ir_node *n, ir_graph *irg) {
+ ir_mode *mymode = get_irn_mode(n);
+ ir_mode *op1mode = get_irn_mode(get_Abs_op(n));
+
+ ASSERT_AND_RET_DBG(
+ /* Abs: BB x num --> num */
+ op1mode == mymode &&
+ mode_is_num (op1mode),
+ "Abs node", 0,
+ show_unop_failure(n, "/* Abs: BB x num --> num */");
+ );
+ return 1;
+}
+
+/**
+ * verify a logical And, Or, Eor node
+ */
+static int verify_node_Logic(ir_node *n, ir_graph *irg) {
+ ir_mode *mymode = get_irn_mode(n);
+ ir_mode *op1mode = get_irn_mode(get_binop_left(n));
+ ir_mode *op2mode = get_irn_mode(get_binop_right(n));
+
+ ASSERT_AND_RET_DBG(
+ /* And or Or or Eor: BB x int x int --> int */
+ (mode_is_int(mymode) || mymode == mode_b) &&
+ op2mode == op1mode &&
+ mymode == op2mode,
+ "And, Or or Eor node", 0,
+ show_binop_failure(n, "/* And or Or or Eor: BB x int x int --> int */");
+ );
+ return 1;
+}
+
+#define verify_node_And verify_node_Logic
+#define verify_node_Or verify_node_Logic
+#define verify_node_Eor verify_node_Logic
+
+/**
+ * verify a Not node
+ */
+static int verify_node_Not(ir_node *n, ir_graph *irg) {
+ ir_mode *mymode = get_irn_mode(n);
+ ir_mode *op1mode = get_irn_mode(get_Not_op(n));
+
+ ASSERT_AND_RET_DBG(
+ /* Not: BB x int --> int */
+ mode_is_int(mymode) &&
+ mymode == op1mode,
+ "Not node", 0,
+ show_unop_failure(n, "/* Not: BB x int --> int */");
+ );
+ return 1;
+}
+
+/**
+ * verify a Cmp node
+ */
+static int verify_node_Cmp(ir_node *n, ir_graph *irg) {
+ ir_mode *mymode = get_irn_mode(n);
+ ir_mode *op1mode = get_irn_mode(get_Cmp_left(n));
+ ir_mode *op2mode = get_irn_mode(get_Cmp_right(n));
+
+ ASSERT_AND_RET_DBG(
+ /* Cmp: BB x datab x datab --> b16 */
+ mode_is_data (op1mode) &&
+ op2mode == op1mode &&
+ mymode == mode_T,
+ "Cmp node", 0,
+ show_binop_failure(n, "/* Cmp: BB x datab x datab --> b16 */");
+ );
+ return 1;
+}
+
+/**
+ * verify a Shift node
+ */
+static int verify_node_Shift(ir_node *n, ir_graph *irg) {
+ ir_mode *mymode = get_irn_mode(n);
+ ir_mode *op1mode = get_irn_mode(get_binop_left(n));
+ ir_mode *op2mode = get_irn_mode(get_binop_right(n));
+
+ ASSERT_AND_RET_DBG(
+ /* Shl, Shr or Shrs: BB x int x int_u --> int */
+ mode_is_int(op1mode) &&
+ mode_is_int(op2mode) &&
+ !mode_is_signed(op2mode) &&
+ mymode == op1mode,
+ "Shl, Shr or Shrs node", 0,
+ show_binop_failure(n, "/* Shl, Shr or Shrs: BB x int x int_u --> int */");
+ );
+ return 1;
+}
+
+#define verify_node_Shl verify_node_Shift
+#define verify_node_Shr verify_node_Shift
+#define verify_node_Shrs verify_node_Shift
+
+/**
+ * verify a Rot node
+ */
+static int verify_node_Rot(ir_node *n, ir_graph *irg) {
+ ir_mode *mymode = get_irn_mode(n);
+ ir_mode *op1mode = get_irn_mode(get_Rot_left(n));
+ ir_mode *op2mode = get_irn_mode(get_Rot_right(n));
+
+ ASSERT_AND_RET_DBG(
+ /* Rot: BB x int x int --> int */
+ mode_is_int(op1mode) &&
+ mode_is_int(op2mode) &&
+ mymode == op1mode,
+ "Rot node", 0,
+ show_binop_failure(n, "/* Rot: BB x int x int --> int */");
+ );
+ return 1;
+}
+
+/**
+ * verify a Conv node
+ */
+static int verify_node_Conv(ir_node *n, ir_graph *irg) {
+ ir_mode *mymode = get_irn_mode(n);
+ ir_mode *op1mode = get_irn_mode(get_Conv_op(n));
+
+ ASSERT_AND_RET_DBG(
+ /* Conv: BB x datab1 --> datab2 */
+ mode_is_datab(op1mode) && mode_is_data(mymode),
+ "Conv node", 0,
+ show_unop_failure(n, "/* Conv: BB x datab1 --> datab2 */");
+ );
+ return 1;
+}
+
+/**
+ * verify a Cast node
+ */
+static int verify_node_Cast(ir_node *n, ir_graph *irg) {
+ ir_mode *mymode = get_irn_mode(n);
+ ir_mode *op1mode = get_irn_mode(get_Cast_op(n));
+
+ ASSERT_AND_RET_DBG(
+ /* Conv: BB x datab1 --> datab2 */
+ mode_is_data(op1mode) && op1mode == mymode,
+ "Cast node", 0,
+ show_unop_failure(n, "/* Conv: BB x datab1 --> datab2 */");
+ );
+ return 1;
+}
+
+/**
+ * verify a Phi node
+ */
+static int verify_node_Phi(ir_node *n, ir_graph *irg) {
+ ir_mode *mymode = get_irn_mode(n);
+ ir_node *block = get_nodes_block(n);
+ int i;
+
+ 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);
+ );