X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firgopt.c;h=034a2a742a8eadc7006116823e041b52a10b0718;hb=8399216d8aebc713bbda04b6e3e250a1d52b20bf;hp=babf9c55bd74e9d3a68a73273ee526de02c90b0a;hpb=9fe9c20a1570729f1bdd21a6f174ec045d2ff986;p=libfirm diff --git a/ir/ir/irgopt.c b/ir/ir/irgopt.c index babf9c55b..034a2a742 100644 --- a/ir/ir/irgopt.c +++ b/ir/ir/irgopt.c @@ -245,7 +245,7 @@ copy_node (ir_node *n, void *env) { /* Copy the attributes. These might point to additional data. If this was allocated on the old obstack the pointers now are dangling. This frees e.g. the memory of the graph_arr allocated in new_immBlock. */ - copy_attrs(n, nn); + copy_node_attr(n, nn); new_backedge_info(nn); set_new_node(n, nn); @@ -357,7 +357,7 @@ copy_graph (int copy_node_nr) { -1, NULL); /* Copy the attributes. Well, there might be some in the future... */ - copy_attrs(oe, ne); + copy_node_attr(oe, ne); set_new_node(oe, ne); /* copy the Bad node */ @@ -529,7 +529,7 @@ dead_node_elimination(ir_graph *irg) { graveyard_obst = irg->obst; /* A new obstack, where the reachable nodes will be copied to. */ - rebirth_obst = (struct obstack *) xmalloc (sizeof (struct obstack)); + rebirth_obst = xmalloc (sizeof(*rebirth_obst)); current_ir_graph->obst = rebirth_obst; obstack_init (current_ir_graph->obst); @@ -907,8 +907,8 @@ int inline_method(ir_node *call, ir_graph *called_graph) { arity = get_irn_arity(end_bl); /* arity = n_exc + n_ret */ n_res = get_method_n_ress(get_Call_type(call)); - res_pred = (ir_node **) xmalloc (n_res * sizeof (ir_node *)); - cf_pred = (ir_node **) xmalloc (arity * sizeof (ir_node *)); + res_pred = xmalloc (n_res * sizeof(*res_pred)); + cf_pred = xmalloc (arity * sizeof(*res_pred)); set_irg_current_block(current_ir_graph, post_bl); /* just to make sure */ @@ -1039,7 +1039,7 @@ int inline_method(ir_node *call, ir_graph *called_graph) { } main_end_bl = get_irg_end_block(current_ir_graph); main_end_bl_arity = get_irn_arity(main_end_bl); - end_preds = (ir_node **) xmalloc ((n_exc + main_end_bl_arity) * sizeof (ir_node *)); + end_preds = xmalloc ((n_exc + main_end_bl_arity) * sizeof(*end_preds)); for (i = 0; i < main_end_bl_arity; ++i) end_preds[i] = get_irn_n(main_end_bl, i); @@ -1083,7 +1083,7 @@ int inline_method(ir_node *call, ir_graph *called_graph) { if (i < get_Block_n_cfgpreds(end_bl)) { bl = get_nodes_block(cf_op); arity = get_Block_n_cfgpreds(end_bl) + get_Block_n_cfgpreds(bl) - 1; - cf_pred = (ir_node **) xmalloc (arity * sizeof (ir_node *)); + cf_pred = xmalloc (arity * sizeof(*cf_pred)); for (j = 0; j < i; j++) cf_pred[j] = get_Block_cfgpred(end_bl, j); for (j = j; j < i + get_Block_n_cfgpreds(bl); j++) @@ -1191,7 +1191,7 @@ void inline_small_irgs(ir_graph *irg, int size) { for (i = 0; i < env.pos; i++) { ir_graph *callee; callee = get_entity_irg(get_SymConst_entity(get_Call_ptr(env.calls[i]))); - if (((_obstack_memory_used(callee->obst) - obstack_room(callee->obst)) < size) || + if (((_obstack_memory_used(callee->obst) - (int)obstack_room(callee->obst)) < size) || (get_irg_inline_property(callee) == irg_inline_forced)) { inline_method(env.calls[i], callee); } @@ -1215,7 +1215,7 @@ typedef struct { } inline_irg_env; static inline_irg_env *new_inline_irg_env(void) { - inline_irg_env *env = xmalloc(sizeof(inline_irg_env)); + inline_irg_env *env = xmalloc(sizeof(*env)); env->n_nodes = -2; /* uncount Start, End */ env->n_nodes_orig = -2; /* uncount Start, End */ env->call_nodes = eset_create(); @@ -1282,7 +1282,7 @@ void inline_leave_functions(int maxsize, int leavesize, int size) { if (!(get_opt_optimize() && get_opt_inline())) return; - /* extend all irgs by a temporary data structure for inlineing. */ + /* extend all irgs by a temporary data structure for inlining. */ for (i = 0; i < n_irgs; ++i) set_irg_link(get_irp_irg(i), new_inline_irg_env()); @@ -1310,8 +1310,10 @@ void inline_leave_functions(int maxsize, int leavesize, int size) { env = (inline_irg_env *)get_irg_link(current_ir_graph); for (call = eset_first(env->call_nodes); call; call = eset_next(env->call_nodes)) { + ir_graph *callee; + if (get_irn_op(call) == op_Tuple) continue; /* We already inlined. */ - ir_graph *callee = get_call_called_irg(call); + callee = get_call_called_irg(call); if (env->n_nodes > maxsize) continue; // break; @@ -1348,8 +1350,10 @@ void inline_leave_functions(int maxsize, int leavesize, int size) { walkset = env->call_nodes; env->call_nodes = eset_create(); for (call = eset_first(walkset); call; call = eset_next(walkset)) { + ir_graph *callee; + if (get_irn_op(call) == op_Tuple) continue; /* We already inlined. */ - ir_graph *callee = get_call_called_irg(call); + callee = get_call_called_irg(call); if (callee && ((is_smaller(callee, size) && (env->n_nodes < maxsize)) || /* small function */