X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbespillslots.c;h=b854d611f15b9413eaa765597f51169696b3f03f;hb=b9d45e08e23bcf058fa8f2d9e18dd78e8cccd044;hp=cee2464b855600ab68c9aa3a6915d18e17c6d8f7;hpb=c5e94f039082de17df10b34a3445c15c0af12f71;p=libfirm diff --git a/ir/be/bespillslots.c b/ir/be/bespillslots.c index cee2464b8..b854d611f 100644 --- a/ir/be/bespillslots.c +++ b/ir/be/bespillslots.c @@ -26,6 +26,7 @@ #include "bechordal_t.h" #include "bejavacoal.h" #include "benodesets.h" +#include "bestatevent.h" #define DBG_COALESCING 1 @@ -188,8 +189,7 @@ static void collect_spills_walker(ir_node *node, void *data) { ss_env_t *env = data; const arch_env_t *arch_env = env->arch_env; - // @@@ ia32 classify returns classification of the irn the proj is attached - // too, why oh why?... + // classify returns classification of the irn the proj is attached to if(is_Proj(node)) return; @@ -725,6 +725,7 @@ static void create_memperms(ss_env_t *env) { // insert node into schedule blockend = get_end_of_block_insertion_point(memperm->block); sched_add_before(blockend, mempermnode); + be_stat_ev("mem_perm", memperm->entrycount); for(entry = memperm->entries, i = 0; entry != NULL; entry = entry->next, ++i) { ir_node *proj; @@ -741,6 +742,25 @@ static void create_memperms(ss_env_t *env) { } } +static int count_spillslots(const ss_env_t *env) { + const spill_t *spill; + int spillcount = set_count(env->spills); + bitset_t *counted = bitset_alloca(spillcount); + int slotcount; + + slotcount = 0; + for(spill = set_first(env->spills); spill != NULL; + spill = set_next(env->spills)) { + int spillslot = spill->spillslot; + if(!bitset_is_set(counted, spillslot)) { + slotcount++; + bitset_set(counted, spillslot); + } + } + + return slotcount; +} + void be_coalesce_spillslots(const be_chordal_env_t *chordal_env, int coalesce_spillslots) { ss_env_t env; @@ -757,8 +777,14 @@ void be_coalesce_spillslots(const be_chordal_env_t *chordal_env, int coalesce_sp /* Get initial spill slots */ irg_walk_graph(chordal_env->irg, NULL, collect_spills_walker, &env); - if(coalesce_spillslots) + be_stat_ev("spillslots", set_count(env.spills)); + + if(coalesce_spillslots) { do_greedy_coalescing(&env); + if(be_stat_ev_is_active()) { + be_stat_ev("spillslots_after_coalescing", count_spillslots(&env)); + } + } assign_spillslots(&env);