* Show Phi input
*/
static void show_phi_failure(ir_node *phi, ir_node *pred, int pos) {
+ (void) pos;
show_entity_failure(phi);
fprintf(stderr, " Phi node %ld has mode %s different from predeccessor node %ld mode %s\n",
get_irn_node_nr(phi), get_mode_name_ex(get_irn_mode(phi)),
static int verify_node_Proj_Start(ir_node *n, ir_node *p) {
ir_mode *mode = get_irn_mode(p);
long proj = get_Proj_proj(p);
+ (void) n;
ASSERT_AND_RET_DBG(
(
static int verify_node_Proj_Raise(ir_node *n, ir_node *p) {
ir_mode *mode = get_irn_mode(p);
long proj = get_Proj_proj(p);
+ (void) n;
ASSERT_AND_RET_DBG(
((proj == pn_Raise_X && mode == mode_X) || (proj == pn_Raise_M && mode == mode_M)),
static int verify_node_Proj_InstOf(ir_node *n, ir_node *p) {
ir_mode *mode = get_irn_mode(p);
long proj = get_Proj_proj(p);
+ (void) n;
ASSERT_AND_RET_DBG(
(
static int verify_node_Proj_Cmp(ir_node *n, ir_node *p) {
ir_mode *mode = get_irn_mode(p);
long proj = get_Proj_proj(p);
+ (void) n;
ASSERT_AND_RET_DBG(
(proj >= 0 && proj <= 15 && mode == mode_b),
static int verify_node_Proj_Alloc(ir_node *n, ir_node *p) {
ir_mode *mode = get_irn_mode(p);
long proj = get_Proj_proj(p);
+ (void) n;
ASSERT_AND_RET_DBG(
(
if (nr == pn_Start_T_args) {
ASSERT_AND_RET(
- (proj >= 0 && mode_is_data(mode)),
+ (proj >= 0 && mode_is_datab(mode)),
"wrong Proj from Proj from Start", 0);
ASSERT_AND_RET(
(proj < get_method_n_params(mt)),
case iro_Call:
{
ASSERT_AND_RET(
- (proj >= 0 && mode_is_data(mode)),
+ (proj >= 0 && mode_is_datab(mode)),
"wrong Proj from Proj from Call", 0);
mt = get_Call_type(pred);
ASSERT_AND_RET(
* verify a Proj(Tuple) node
*/
static int verify_node_Proj_Tuple(ir_node *n, ir_node *p) {
+ (void) n;
+ (void) p;
/* We don't test */
return 1;
}
* verify a Proj(CallBegin) node
*/
static int verify_node_Proj_CallBegin(ir_node *n, ir_node *p) {
+ (void) n;
+ (void) p;
return 1;
}
* verify a Proj(EndReg) node
*/
static int verify_node_Proj_EndReg(ir_node *n, ir_node *p) {
+ (void) n;
+ (void) p;
ASSERT_AND_RET(
(get_irp_ip_view_state() != ip_view_no),
"EndReg may only appear if ip view is constructed.", 0);
* verify a Proj(EndExcept) node
*/
static int verify_node_Proj_EndExcept(ir_node *n, ir_node *p) {
+ (void) n;
+ (void) p;
ASSERT_AND_RET(
(get_irp_ip_view_state() != ip_view_no),
"EndExcept may only appear if ip view is constructed.", 0);
verify_node_Proj(ir_node *p, ir_graph *irg) {
ir_node *pred;
ir_op *op;
+ (void) irg;
pred = skip_Id(get_Proj_pred(p));
ASSERT_AND_RET(get_irn_mode(pred) == mode_T, "mode of a 'projed' node is not Tuple", 0);
*/
static int verify_node_Start(ir_node *n, ir_graph *irg) {
ir_mode *mymode = get_irn_mode(n);
+ (void) irg;
ASSERT_AND_RET(
/* Start: BB --> X x M x ref x data1 x ... x datan x ref */
*/
static int verify_node_Jmp(ir_node *n, ir_graph *irg) {
ir_mode *mymode = get_irn_mode(n);
+ (void) irg;
ASSERT_AND_RET(
/* Jmp: BB --> X */
static int verify_node_IJmp(ir_node *n, ir_graph *irg) {
ir_mode *mymode = get_irn_mode(n);
ir_mode *op1mode = get_irn_mode(get_IJmp_target(n));
+ (void) irg;
ASSERT_AND_RET(
/* IJmp: BB x ref --> X */
*/
static int verify_node_Break(ir_node *n, ir_graph *irg) {
ir_mode *mymode = get_irn_mode(n);
+ (void) irg;
ASSERT_AND_RET((get_irp_ip_view_state() != ip_view_no),
"Break may only appear if ip view is constructed.", 0);
static int verify_node_Cond(ir_node *n, ir_graph *irg) {
ir_mode *mymode = get_irn_mode(n);
ir_mode *op1mode = get_irn_mode(get_Cond_selector(n));
+ (void) irg;
ASSERT_AND_RET(
/* Cond: BB x b --> X x X */
ASSERT_AND_RET( mem_mode == mode_M, "Return node", 0 ); /* operand M */
for (i = get_Return_n_ress(n) - 1; i >= 0; --i) {
- ASSERT_AND_RET( mode_is_data(get_irn_mode(get_Return_res(n, i))), "Return node", 0 ); /* operand datai */
+ ASSERT_AND_RET( mode_is_datab(get_irn_mode(get_Return_res(n, i))), "Return node", 0 ); /* operand datai */
}
ASSERT_AND_RET( mymode == mode_X, "Result X", 0 ); /* result X */
/* Compare returned results with result types of method type */
ir_mode *mymode = get_irn_mode(n);
ir_mode *op1mode = get_irn_mode(get_Raise_mem(n));
ir_mode *op2mode = get_irn_mode(get_Raise_exo_ptr(n));
+ (void) irg;
ASSERT_AND_RET(
/* Sel: BB x M x ref --> X x M */
*/
static int verify_node_Const(ir_node *n, ir_graph *irg) {
ir_mode *mymode = get_irn_mode(n);
+ (void) irg;
ASSERT_AND_RET(
/* Const: BB --> data */
*/
static int verify_node_SymConst(ir_node *n, ir_graph *irg) {
ir_mode *mymode = get_irn_mode(n);
+ (void) irg;
if (get_SymConst_kind(n) == symconst_addr_ent) {
ir_entity *ent = get_SymConst_entity(n);
ir_mode *op1mode = get_irn_mode(get_Sel_mem(n));
ir_mode *op2mode = get_irn_mode(get_Sel_ptr(n));
ir_entity *ent;
+ (void) irg;
ASSERT_AND_RET_DBG(
/* Sel: BB x M x ref x int^n --> ref */
static int verify_node_InstOf(ir_node *n, ir_graph *irg) {
ir_mode *mymode = get_irn_mode(n);
ir_mode *op1mode = get_irn_mode(get_InstOf_obj(n));
+ (void) irg;
ASSERT_AND_RET(mode_T == mymode, "mode of Instof is not a tuple", 0);
ASSERT_AND_RET(mode_is_data(op1mode), "Instof not on data", 0);
return 1;
}
+/**
+ * Check if the pinned state is right.
+ */
+static int verify_right_pinned(ir_node *n) {
+ ir_node *mem;
+
+ if (get_irn_pinned(n) == op_pin_state_pinned)
+ return 1;
+ mem = get_Call_mem(n);
+
+ /* if it's not pinned, its memory predecessor must be NoMem or Pin */
+ if (is_NoMem(mem) || is_Pin(mem))
+ return 1;
+ return 0;
+}
+
/**
* verify a Call node
*/
ir_mode *op2mode = get_irn_mode(get_Call_ptr(n));
ir_type *mt;
int i;
+ (void) irg;
/* Call: BB x M x ref x data1 x ... x datan
--> M x datan+1 x ... x data n+m */
ASSERT_AND_RET( op1mode == mode_M && mode_is_reference(op2mode), "Call node", 0 ); /* operand M x ref */
/* NoMem nodes are only allowed as memory input if the Call is NOT pinned */
- ASSERT_AND_RET(
- (get_irn_op(get_Call_mem(n)) == op_NoMem) ||
- (get_irn_op(get_Call_mem(n)) != op_NoMem && get_irn_pinned(n) == op_pin_state_pinned),
- "Call node with wrong memory input", 0 );
+ ASSERT_AND_RET(verify_right_pinned(n),"Call node with wrong memory input", 0 );
mt = get_Call_type(n);
if(get_unknown_type() == mt) {
}
for (i = get_Call_n_params(n) - 1; i >= 0; --i) {
- ASSERT_AND_RET( mode_is_data(get_irn_mode(get_Call_param(n, i))), "Call node", 0 ); /* operand datai */
+ ASSERT_AND_RET( mode_is_datab(get_irn_mode(get_Call_param(n, i))), "Call node", 0 ); /* operand datai */
}
ASSERT_AND_RET( mymode == mode_T, "Call result not a tuple", 0 ); /* result T */
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));
+ (void) irg;
ASSERT_AND_RET_DBG(
(
/* common Add: BB x numP x numP --> numP */
- (op1mode == mymode && op2mode == op1mode && mode_is_numP(mymode)) ||
+ (op1mode == mymode && op2mode == op1mode && mode_is_data(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 */
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));
+ (void) irg;
ASSERT_AND_RET_DBG(
(
/* common Sub: BB x numP x numP --> numP */
- (mymode ==op1mode && mymode == op2mode && mode_is_numP(op1mode)) ||
+ (mymode ==op1mode && mymode == op2mode && mode_is_data(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 */
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));
+ (void) irg;
ASSERT_AND_RET_DBG(
/* Minus: BB x num --> num */
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));
+ (void) irg;
ASSERT_AND_RET_DBG(
(
- /* Mul: BB x int1 x int1 --> int2 */
- (mode_is_int(op1mode) && op2mode == op1mode && mode_is_int(mymode)) ||
+ /* Mul: BB x int_n x int_n --> int_n|int_2n */
+ (mode_is_int(op1mode) && op2mode == op1mode && mode_is_int(mymode) &&
+ (op1mode == mymode || get_mode_size_bits(op1mode) * 2 == get_mode_size_bits(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"
+ show_binop_failure(n, "/* Mul: BB x int_n x int_n --> int_n|int_2n */ |\n"
"/* Mul: BB x float x float --> float */");
);
return 1;
}
+/**
+ * verify a Mulh node
+ */
+static int verify_node_Mulh(ir_node *n, ir_graph *irg) {
+ ir_mode *mymode = get_irn_mode(n);
+ ir_mode *op1mode = get_irn_mode(get_Mulh_left(n));
+ ir_mode *op2mode = get_irn_mode(get_Mulh_right(n));
+ (void) irg;
+
+ ASSERT_AND_RET_DBG(
+ (
+ /* Mulh: BB x int x int --> int */
+ (mode_is_int(op1mode) && op2mode == op1mode && op1mode == mymode)
+ ),
+ "Mulh node",0,
+ show_binop_failure(n, "/* Mulh: BB x int x int --> int */");
+ );
+ return 1;
+}
+
/**
* verify a Quot node
*/
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));
+ (void) irg;
ASSERT_AND_RET_DBG(
/* Quot: BB x M x float x float --> M x X x float */
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));
+ (void) irg;
ASSERT_AND_RET(
/* DivMod: BB x M x int x int --> M x X x int x int */
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));
+ (void) irg;
ASSERT_AND_RET(
/* Div: BB x M x int x int --> M x X x int */
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));
+ (void) irg;
ASSERT_AND_RET(
/* Mod: BB x M x int x int --> M x X x int */
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));
+ (void) irg;
ASSERT_AND_RET_DBG(
/* Abs: BB x num --> num */
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));
+ (void) irg;
ASSERT_AND_RET_DBG(
/* And or Or or Eor: BB x int x int --> int */
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));
+ (void) irg;
ASSERT_AND_RET_DBG(
/* Not: BB x int --> int */
- mode_is_int(mymode) &&
+ (mode_is_int(mymode) || mymode == mode_b) &&
mymode == op1mode,
"Not node", 0,
show_unop_failure(n, "/* Not: BB x int --> int */");
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));
+ (void) irg;
ASSERT_AND_RET_DBG(
/* Cmp: BB x datab x datab --> b16 */
- mode_is_data (op1mode) &&
+ mode_is_datab(op1mode) &&
op2mode == op1mode &&
mymode == mode_T,
"Cmp node", 0,
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));
+ (void) irg;
ASSERT_AND_RET_DBG(
/* Shl, Shr or Shrs: BB x int x int_u --> int */
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));
+ (void) irg;
ASSERT_AND_RET_DBG(
/* Rot: BB x int x int --> int */
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));
+ (void) irg;
ASSERT_AND_RET_DBG(
/* Conv: BB x datab1 --> datab2 */
- mode_is_datab(op1mode) && mode_is_data(mymode),
+ mode_is_datab(op1mode) && mode_is_datab(mymode),
"Conv node", 0,
show_unop_failure(n, "/* Conv: BB x datab1 --> datab2 */");
);
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));
+ (void) irg;
ASSERT_AND_RET_DBG(
/* Conv: BB x datab1 --> datab2 */
ir_mode *mymode = get_irn_mode(n);
ir_node *block = get_nodes_block(n);
int i;
+ (void) irg;
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( mode_is_dataM(mymode), "Phi node", 0 );
+ ASSERT_AND_RET(mode_is_dataM(mymode) || mymode == mode_b, "Phi node", 0 );
if (mymode == mode_M) {
for (i = get_Phi_n_preds(n) - 1; i >= 0; --i) {
* verify a Filter node
*/
static int verify_node_Filter(ir_node *n, ir_graph *irg) {
+ (void) n;
+ (void) irg;
ASSERT_AND_RET((get_irp_ip_view_state() != ip_view_no),
"Filter may only appear if ip view is constructed.", 0);
/* We should further do tests as for Proj and Phi. */
ir_mode *op2mode = get_irn_mode(get_Store_ptr(n));
ir_mode *op3mode = get_irn_mode(get_Store_value(n));
- ASSERT_AND_RET(op1mode == mode_M && mode_is_data(op3mode), "Store node", 0 );
+ ASSERT_AND_RET(op1mode == mode_M && mode_is_datab(op3mode), "Store node", 0 );
if (get_irg_phase_state(irg) != phase_backend) {
ASSERT_AND_RET(mode_is_reference(op2mode), "Store node", 0 );
} else {
ir_mode *mymode = get_irn_mode(n);
ir_mode *op1mode = get_irn_mode(get_Alloc_mem(n));
ir_mode *op2mode = get_irn_mode(get_Alloc_size(n));
+ (void) irg;
ASSERT_AND_RET_DBG(
/* Alloc: BB x M x int_u --> M x X x ref */
ir_mode *op1mode = get_irn_mode(get_Free_mem(n));
ir_mode *op2mode = get_irn_mode(get_Free_ptr(n));
ir_mode *op3mode = get_irn_mode(get_Free_size(n));
+ (void) irg;
ASSERT_AND_RET_DBG(
/* Free: BB x M x ref x int_u --> M */
static int verify_node_Sync(ir_node *n, ir_graph *irg) {
int i;
ir_mode *mymode = get_irn_mode(n);
+ (void) irg;
/* Sync: BB x M^n --> M */
for (i = get_Sync_n_preds(n) - 1; i >= 0; --i) {
ir_mode *mymode = get_irn_mode(n);
ir_mode *op1mode = get_irn_mode(get_Confirm_value(n));
ir_mode *op2mode = get_irn_mode(get_Confirm_bound(n));
+ (void) irg;
ASSERT_AND_RET_DBG(
/* Confirm: BB x T x T --> T */
ir_mode *op1mode = get_irn_mode(get_Mux_sel(n));
ir_mode *op2mode = get_irn_mode(get_Mux_true(n));
ir_mode *op3mode = get_irn_mode(get_Mux_false(n));
+ (void) irg;
ASSERT_AND_RET(
/* Mux: BB x b x numP x numP --> numP */
op1mode == mode_b &&
op2mode == mymode &&
op3mode == mymode &&
- mode_is_numP(mymode),
+ mode_is_data(mymode),
"Mux node", 0
);
return 1;
/* NoMem nodes are only allowed as memory input if the CopyB is NOT pinned.
This should happen RARELY, as CopyB COPIES MEMORY */
- ASSERT_AND_RET(
- (get_irn_op(get_CopyB_mem(n)) == op_NoMem) ||
- (get_irn_op(get_CopyB_mem(n)) != op_NoMem && get_irn_pinned(n) == op_pin_state_pinned),
- "CopyB node with wrong memory input", 0 );
+ ASSERT_AND_RET(verify_right_pinned(n), "CopyB node with wrong memory input", 0 );
return 1;
}
ir_mode *op2mode = get_irn_mode(get_Bound_index(n));
ir_mode *op3mode = get_irn_mode(get_Bound_lower(n));
ir_mode *op4mode = get_irn_mode(get_Bound_upper(n));
+ (void) irg;
/* Bound: BB x M x int x int x int --> M x X */
ASSERT_AND_RET(
*/
static int check_dominance_for_node(ir_node *use) {
/* This won't work for blocks and the end node */
- if (!is_Block(use) && use != get_irg_end(current_ir_graph)) {
+ if (!is_Block(use) && use != get_irg_end(current_ir_graph) && use != current_ir_graph->anchor) {
int i;
ir_node *bl = get_nodes_block(use);
/* We don't want to test nodes whose predecessors are Bad,
as we would have to special case that for each operation. */
- if (op != op_Phi && op != op_Block)
+ if (op != op_Phi && op != op_Block) {
for (i = get_irn_arity(n) - 1; i >= 0; --i) {
if (is_Bad(get_irn_n(n, i)))
return 1;
}
+ }
+
+ if (_get_op_pinned(op) >= op_pin_state_exc_pinned) {
+ op_pin_state state = get_irn_pinned(n);
+ ASSERT_AND_RET_DBG(
+ state == op_pin_state_floats ||
+ state == op_pin_state_pinned,
+ "invalid pin state", 0,
+ ir_printf("node %+F", n));
+ }
if (op->ops.verify_node)
return op->ops.verify_node(n, irg);
int *res = env;
*res = irn_vrfy(node);
- if (*res)
+ if (*res) {
*res = check_dominance_for_node(node);
+ }
}
#endif /* DEBUG_libfirm */
if (flags & VRFY_ENFORCE_SSA)
compute_doms(irg);
- irg_walk_graph(
+ irg_walk_anchors(
irg,
get_irg_dom_state(irg) == dom_consistent &&
get_irg_pinned(irg) == op_pin_state_pinned ? vrfy_wrap_ssa : vrfy_wrap,
CASE(Sub);
CASE(Minus);
CASE(Mul);
+ CASE(Mulh);
CASE(Quot);
CASE(DivMod);
CASE(Div);