entity *ent = get_irg_entity(irg);
if (ent) {
- type *ent_type = get_entity_owner(ent);
+ ir_type *ent_type = get_entity_owner(ent);
if (ent_type) {
if (ent_type == get_glob_type())
/**
* Prints a failure message for a proj from Start
*/
-static void show_proj_mode_failure(ir_node *n, type *ty)
+static void show_proj_mode_failure(ir_node *n, ir_type *ty)
{
long proj = get_Proj_proj(n);
ir_mode *m = get_type_mode(ty);
/**
* Show call parameters
*/
-static void show_call_param(ir_node *n, type *mt)
+static void show_call_param(ir_node *n, ir_type *mt)
{
int i;
/**
* Show return modes
*/
-static void show_return_modes(ir_graph *irg, ir_node *n, type *mt, int i)
+static void show_return_modes(ir_graph *irg, ir_node *n, ir_type *mt, int i)
{
entity *ent = get_irg_entity(irg);
/**
* Show return number of results
*/
-static void show_return_nres(ir_graph *irg, ir_node *n, type *mt)
+static void show_return_nres(ir_graph *irg, ir_node *n, ir_type *mt)
{
entity *ent = get_irg_entity(irg);
ir_mode *mode = get_irn_mode(p);
long proj = get_Proj_proj(p);
long nr = get_Proj_proj(pred);
- type *mt; /* A method type */
+ ir_type *mt; /* A method type */
pred = skip_Id(get_Proj_pred(pred));
ASSERT_AND_RET((get_irn_mode(pred) == mode_T), "Proj from something not a tuple", 0);
break;
default:
- ASSERT_AND_RET(0, "Unknown opcode", 0);
+ /* ASSERT_AND_RET(0, "Unknown opcode", 0); */
+ break;
}
return 1;
}
return 1;
}
+/**
+ * verify a Proj(CopyB) node
+ */
+static int verify_node_Proj_CopyB(ir_node *n, ir_node *p) {
+ ir_mode *mode = get_irn_mode(p);
+ long proj = get_Proj_proj(p);
+
+ ASSERT_AND_RET_DBG(
+ ((proj == pn_CopyB_M && mode == mode_M) ||
+ (proj == pn_CopyB_X_except && mode == mode_X)),
+ "wrong Proj from CopyB", 0,
+ show_proj_failure(p);
+ );
+ if (proj == pn_CopyB_X_except)
+ ASSERT_AND_RET(
+ get_irn_pinned(n) == op_pin_state_pinned,
+ "Exception Proj from unpinned CopyB", 0);
+ return 1;
+}
+
+/**
+ * verify a Proj(Bound) node
+ */
+static int verify_node_Proj_Bound(ir_node *n, ir_node *p) {
+ ir_mode *mode = get_irn_mode(p);
+ long proj = get_Proj_proj(p);
+
+ ASSERT_AND_RET_DBG(
+ ((proj == pn_Bound_M && mode == mode_M) ||
+ (proj == pn_Bound_X_except && mode == mode_X) ||
+ (proj == pn_Bound_res && mode == get_irn_mode(get_Bound_index(n)))),
+ "wrong Proj from Bound", 0,
+ show_proj_failure(p);
+ );
+ if (proj == pn_Bound_X_except)
+ ASSERT_AND_RET(
+ get_irn_pinned(n) == op_pin_state_pinned,
+ "Exception Proj from unpinned Bound", 0);
+ return 1;
+}
+
/**
* verify a Proj node
*/
ir_node *pred = skip_Proj(get_Block_cfgpred(n, i));
if (is_Proj(pred) || get_irn_op(pred) == op_Tuple)
break; /* We can not test properly. How many tuples are there? */
- ASSERT_AND_RET(((get_irn_op(pred) == op_Return) ||
+ ASSERT_AND_RET((is_Return(pred) ||
is_Bad(pred) ||
(get_irn_op(pred) == op_Raise) ||
is_fragile_op(pred) ),
int i;
ir_mode *mymode = get_irn_mode(n);
ir_mode *mem_mode = get_irn_mode(get_Return_mem(n));
- type *mt;
+ ir_type *mt;
/* Return: BB x M x data1 x ... x datan --> X */
"Number of results for Return doesn't match number of results in type.", 0,
show_return_nres(irg, n, mt););
for (i = get_Return_n_ress(n) - 1; i >= 0; --i) {
- type *res_type = get_method_res_type(mt, i);
+ ir_type *res_type = get_method_res_type(mt, i);
if (is_atomic_type(res_type)) {
ASSERT_AND_RET_DBG(
mymode == mode_b) /* we want boolean constants for static evaluation */
,"Const node", 0 /* of Cmp. */
);
+ ASSERT_AND_RET(
+ /* the modes of the constant and teh tarval must match */
+ mymode == get_tarval_mode(get_Const_tarval(n)),
+ "Const node, tarval and node mode mismatch", 0
+ );
return 1;
}
ir_mode *mymode = get_irn_mode(n);
ir_mode *op1mode = get_irn_mode(get_Call_mem(n));
ir_mode *op2mode = get_irn_mode(get_Call_ptr(n));
- type *mt;
+ ir_type *mt;
int i;
/* Call: BB x M x ref x data1 x ... x datan
}
for (i = 0; i < get_method_n_params(mt); i++) {
- type *t = get_method_param_type(mt, i);
+ ir_type *t = get_method_param_type(mt, i);
if (is_atomic_type(t)) {
ASSERT_AND_RET_DBG(
ASSERT_AND_RET_DBG(
/* And or Or or Eor: BB x int x int --> int */
- mode_is_int(mymode) &&
+ (mode_is_int(mymode) || mymode == mode_b) &&
op2mode == op1mode &&
mymode == op2mode,
"And, Or or Eor node", 0,
ir_mode *op1mode = get_irn_mode(get_CopyB_mem(n));
ir_mode *op2mode = get_irn_mode(get_CopyB_dst(n));
ir_mode *op3mode = get_irn_mode(get_CopyB_src(n));
- type *t = get_CopyB_type(n);
+ ir_type *t = get_CopyB_type(n);
/* CopyB: BB x M x ref x ref --> M x X */
ASSERT_AND_RET(
return 1;
}
+/**
+ * verify a Bound node
+ */
+static int verify_node_Bound(ir_node *n, ir_graph *irg) {
+ ir_mode *mymode = get_irn_mode(n);
+ ir_mode *op1mode = get_irn_mode(get_Bound_mem(n));
+ 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));
+
+ /* Bound: BB x M x ref x ref --> M x X */
+ ASSERT_AND_RET(
+ mymode == mode_T &&
+ op1mode == mode_M &&
+ op2mode == op3mode &&
+ op3mode == op4mode &&
+ mode_is_int(op3mode),
+ "Bound node", 0 ); /* operand M x int x int x int */
+
+ /* NoMem nodes are only allowed as memory input if the Bound is NOT pinned.
+ This should happen RARELY, as Bound COPIES MEMORY */
+ ASSERT_AND_RET(
+ (get_irn_op(get_Bound_mem(n)) == op_NoMem) ||
+ (get_irn_op(get_Bound_mem(n)) != op_NoMem && get_irn_pinned(n) == op_pin_state_pinned),
+ "Bound node with wrong memory input", 0 );
+ return 1;
+}
+
/*
* Check dominance.
* For each usage of a node, it is checked, if the block of the
show_node_on_graph(irg, n);
);
assert(get_irn_irg(n) == irg);
+ {
+ unsigned idx = get_irn_idx(n);
+ ir_node *node_from_map = get_idx_irn(irg, idx);
+ ASSERT_AND_RET_DBG(node_from_map == n, "Node index and index map entry differ", 0, ir_printf("node %+F node in map %+F(%p)", n, node_from_map, node_from_map));
+ }
}
op = get_irn_op(n);
CASE(Confirm);
CASE(Mux);
CASE(CopyB);
+ CASE(Bound);
default:
/* leave NULL */;
}
CASE(CallBegin);
CASE(EndReg);
CASE(EndExcept);
+ CASE(CopyB);
+ CASE(Bound);
default:
/* leave NULL */;
}