X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;ds=sidebyside;f=ir%2Farch%2Fmodeconv.c;h=5a3d597884380e7e0f7a24b84d5bb3e8273dd55a;hb=9996abb0e59c2995f60d31ccc81ae80eea678ea2;hp=e26ff267234973c8effade8ea2184adccde43c6f;hpb=5056059f63cbb2af8fb5691a3f7948feea2dd5d7;p=libfirm diff --git a/ir/arch/modeconv.c b/ir/arch/modeconv.c index e26ff2672..5a3d59788 100644 --- a/ir/arch/modeconv.c +++ b/ir/arch/modeconv.c @@ -36,10 +36,10 @@ # include "firmstat.h" typedef struct _walker_t { - int bits; - ir_mode *s_mode; /**< signed mode */ - ir_mode *u_mode; /**< unsigned mode */ - int changes; + int bits; /**< number of bits in the destination mode */ + ir_mode *s_mode; /**< signed destination mode */ + ir_mode *u_mode; /**< unsigned destination mode */ + int changes; /**< non-zero if the graph was changed */ } walker_t; /** @@ -49,7 +49,9 @@ static ir_node *fix_irn_output(ir_node *node, ir_mode *mode) { switch (get_irn_opcode(node)) { case iro_Proj: + /* Args, Load, Div, Mod */ case iro_Conv: + /* Hmm, maybe the Conv should be replaced */ case iro_Rot: { ir_node *block = get_nodes_block(node); @@ -99,7 +101,7 @@ static void fix_mode(ir_node *n, ir_mode *mode) code = get_irn_opcode(get_Proj_pred(n)); } - switch (code){ + switch (code) { case iro_Return: case iro_Load: case iro_Proj: @@ -125,16 +127,16 @@ static void do_mode_conv(ir_node *n, void *env) set_irn_link(n, mode); /* special case: fix the Return */ - if (get_irn_op(n) == op_Return) { + if (is_Return(n)) { entity *ent = get_irg_entity(current_ir_graph); - type *mt = get_entity_type(ent); + ir_type *mt = get_entity_type(ent); int i, n_ress = get_method_n_ress(mt); mode = mode_is_signed(mode) ? wenv->s_mode : wenv->u_mode; block = get_nodes_block(n); for (i = 0; i < n_ress; ++i) { ir_node *pred = get_irn_n(n, i + 1); - type *rt = get_method_res_type(mt, i); + ir_type *rt = get_method_res_type(mt, i); if (is_atomic_type(rt)) { mode = get_type_mode(rt); @@ -162,9 +164,6 @@ static void do_mode_conv(ir_node *n, void *env) ir_node *pred = get_Conv_op(n); ir_mode *modeA = get_irn_link(pred); - if (get_irn_node_nr(n) == 171) - printf("HAllo\n"); - if (modeA != get_irn_mode(pred)) { pred = new_r_Conv(current_ir_graph, get_nodes_block(pred), pred, modeA); set_Conv_op(n, pred); @@ -240,13 +239,12 @@ void arch_mode_conversion(ir_graph *irg, ir_mode *mode) env.bits = get_mode_size_bits(mode); env.changes = 0; - assert(env.s_mode && env.u_mode && "Cpould not find modes"); + assert(env.s_mode && env.u_mode && "Could not find modes"); irg_walk_graph(irg, NULL, do_mode_conv, &env); - /* Handle graph state */ + /* Handle graph state. We never change control flow. */ if (env.changes) { - if (get_irg_outs_state(current_ir_graph) == outs_consistent) - set_irg_outs_inconsistent(current_ir_graph); + set_irg_outs_inconsistent(current_ir_graph); } }