X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fopt%2Fopt_inline.c;h=7f0998b6d1a61e95b1e0a6e62f876ec6eb8e63c7;hb=2f7da22ade10e502888999170ef42fcf9a619852;hp=dba9b562496da135ea66a5240a3f673938044c7b;hpb=8e9eef55583cb2e48e8dc89ddc30c225ba9f1af4;p=libfirm diff --git a/ir/opt/opt_inline.c b/ir/opt/opt_inline.c index dba9b5624..7f0998b6d 100644 --- a/ir/opt/opt_inline.c +++ b/ir/opt/opt_inline.c @@ -41,13 +41,13 @@ #include "irgmod.h" #include "irgwalk.h" -#include "adt/array.h" -#include "adt/list.h" -#include "adt/pset.h" -#include "adt/pmap.h" -#include "adt/pdeq.h" -#include "adt/xmalloc.h" -#include "adt/pqueue.h" +#include "array_t.h" +#include "list.h" +#include "pset.h" +#include "pmap.h" +#include "pdeq.h" +#include "xmalloc.h" +#include "pqueue.h" #include "irouts.h" #include "irloop_t.h" @@ -2022,8 +2022,7 @@ static ir_graph **create_irg_list(void) { } /** - * Push a call onto the priority list if its - * benefice is big enough. + * Push a call onto the priority list if its benefice is big enough. * * @param pqueue the priority queue of calls * @param call the call entry @@ -2033,24 +2032,16 @@ static ir_graph **create_irg_list(void) { static void maybe_push_call(pqueue_t *pqueue, call_entry *call, int inline_threshold) { - int benefice; ir_graph *callee = call->callee; irg_inline_property prop = get_irg_inline_property(callee); + int benefice = calc_inline_benefice(call, callee); - if (prop >= irg_inline_forced) { - /* give them a big benefice, so forced are inline first */ - benefice = 100000 + call->loop_depth; - call->benefice = benefice; - DB((dbg, LEVEL_2, "In %+F Call %+F to %+F is forced\n", - get_irn_irg(call->call), call->call, callee)); - } else { - benefice = calc_inline_benefice(call, callee); - DB((dbg, LEVEL_2, "In %+F Call %+F to %+F has benefice %d\n", - get_irn_irg(call->call), call->call, callee, benefice)); - } + DB((dbg, LEVEL_2, "In %+F Call %+F to %+F has benefice %d\n", + get_irn_irg(call->call), call->call, callee, benefice)); - if (benefice < inline_threshold && prop < irg_inline_forced) + if (prop < irg_inline_forced && benefice < inline_threshold) { return; + } pqueue_put(pqueue, call, benefice); } @@ -2283,22 +2274,18 @@ void inline_functions(unsigned maxsize, int inline_threshold) { env = get_irg_link(irg); if (env->got_inline) { /* this irg got calls inlined: optimize it */ - - if (0) { - /* scalar replacement does not work well with Tuple nodes, so optimize them away */ - optimize_graph_df(irg); - + if (get_opt_combo()) { + if (env->local_vars) { + scalar_replacement_opt(irg); + } + combo(irg); + } else { if (env->local_vars) { if (scalar_replacement_opt(irg)) { optimize_graph_df(irg); } } optimize_cf(irg); - } else { - if (env->local_vars) { - scalar_replacement_opt(irg); - } - combo(irg); } } if (env->got_inline || (env->n_callers_orig != env->n_callers)) {