X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firvrfy.c;h=58e5de00b908d338c93e7799d24e34b0a5b370a5;hb=e1c33a238578342a072e1c95ff12eefe6d0acd37;hp=d366cf60b8e59a29ea6d98d5a6a839eb83db9f32;hpb=c7f92b19d9eb6777c6d98f35e7e8b0c08faeffc9;p=libfirm diff --git a/ir/ir/irvrfy.c b/ir/ir/irvrfy.c index d366cf60b..58e5de00b 100644 --- a/ir/ir/irvrfy.c +++ b/ir/ir/irvrfy.c @@ -67,7 +67,7 @@ static void show_entity_failure(ir_node *node) 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()) @@ -166,7 +166,7 @@ static void show_proj_failure(ir_node *n) /** * 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); @@ -209,7 +209,7 @@ static void show_node_on_graph(ir_graph *irg, ir_node *n) /** * 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; @@ -230,7 +230,7 @@ static void show_call_param(ir_node *n, type *mt) /** * 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); @@ -245,7 +245,7 @@ static void show_return_modes(ir_graph *irg, ir_node *n, type *mt, int i) /** * 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); @@ -590,7 +590,7 @@ static int verify_node_Proj_Proj(ir_node *pred, ir_node *p) { 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); @@ -655,7 +655,8 @@ static int verify_node_Proj_Proj(ir_node *pred, ir_node *p) { break; default: - ASSERT_AND_RET(0, "Unknown opcode", 0); + /* ASSERT_AND_RET(0, "Unknown opcode", 0); */ + break; } return 1; } @@ -775,7 +776,7 @@ static int verify_node_Block(ir_node *n, ir_graph *irg) { 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) ), @@ -868,7 +869,7 @@ static int verify_node_Return(ir_node *n, ir_graph *irg) { 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 */ @@ -884,7 +885,7 @@ static int verify_node_Return(ir_node *n, ir_graph *irg) { "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( @@ -932,6 +933,11 @@ static int verify_node_Const(ir_node *n, ir_graph *irg) { 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; } @@ -1003,7 +1009,7 @@ static int verify_node_Call(ir_node *n, ir_graph *irg) { 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 @@ -1045,7 +1051,7 @@ static int verify_node_Call(ir_node *n, ir_graph *irg) { } 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( @@ -1267,7 +1273,7 @@ static int verify_node_Logic(ir_node *n, ir_graph *irg) { 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, @@ -1599,7 +1605,7 @@ static int verify_node_CopyB(ir_node *n, ir_graph *irg) { 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( @@ -1712,6 +1718,11 @@ int irn_vrfy_irg(ir_node *n, ir_graph *irg) 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);