X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbechordal_main.c;h=a7159f971bc55d66858d315a1670db7417c8b42e;hb=4ed245f5007168dab7850942a7ee6b6b29a19817;hp=c1d7cdf926158db79e56f5071b9e54ceeea04a66;hpb=8105317384cd99ef55d8c052684a401b2484f64b;p=libfirm diff --git a/ir/be/bechordal_main.c b/ir/be/bechordal_main.c index c1d7cdf92..a7159f971 100644 --- a/ir/be/bechordal_main.c +++ b/ir/be/bechordal_main.c @@ -35,6 +35,8 @@ #include "irdom.h" #include "ircons.h" #include "irbitset.h" +#include "irnode.h" +#include "ircons.h" #include "debug.h" #include "xmalloc.h" #include "execfreq.h" @@ -54,17 +56,20 @@ #include "bespillbelady.h" #include "bespillmorgan.h" +#include "bespillslots.h" #include "belower.h" #ifdef WITH_ILP #include "bespillremat.h" #endif /* WITH_ILP */ +#include "bejavacoal.h" #include "becopystat.h" #include "becopyopt.h" #include "bessadestr.h" #include "beverify.h" #include "bespillcost.h" +#include "benode_t.h" void be_ra_chordal_check(be_chordal_env_t *chordal_env) { const arch_env_t *arch_env = chordal_env->birg->main_env->arch_env; @@ -135,6 +140,7 @@ static be_ra_timer_t ra_timer = { NULL, NULL, NULL, + NULL, }; #ifdef WITH_LIBCORE @@ -168,16 +174,17 @@ static const lc_opt_enum_int_items_t lower_perm_stat_items[] = { }; static const lc_opt_enum_int_items_t dump_items[] = { - { "spill", BE_CH_DUMP_SPILL }, - { "live", BE_CH_DUMP_LIVE }, - { "color", BE_CH_DUMP_COLOR }, - { "copymin", BE_CH_DUMP_COPYMIN }, - { "ssadestr", BE_CH_DUMP_SSADESTR }, - { "tree", BE_CH_DUMP_TREE_INTV }, - { "constr", BE_CH_DUMP_CONSTR }, - { "lower", BE_CH_DUMP_LOWER }, - { "appel", BE_CH_DUMP_APPEL }, - { "all", BE_CH_DUMP_ALL }, + { "spill", BE_CH_DUMP_SPILL }, + { "live", BE_CH_DUMP_LIVE }, + { "color", BE_CH_DUMP_COLOR }, + { "copymin", BE_CH_DUMP_COPYMIN }, + { "ssadestr", BE_CH_DUMP_SSADESTR }, + { "tree", BE_CH_DUMP_TREE_INTV }, + { "constr", BE_CH_DUMP_CONSTR }, + { "lower", BE_CH_DUMP_LOWER }, + { "spillslots", BE_CH_DUMP_SPILLSLOTS }, + { "appel", BE_CH_DUMP_APPEL }, + { "all", BE_CH_DUMP_ALL }, { NULL, 0 } }; @@ -225,6 +232,9 @@ static const lc_opt_table_entry_t be_chordal_options[] = { { NULL } }; +extern void be_spill_remat_register_options(lc_opt_entry_t *ent); + + static void be_ra_chordal_register_options(lc_opt_entry_t *grp) { static int run_once = 0; @@ -238,7 +248,10 @@ static void be_ra_chordal_register_options(lc_opt_entry_t *grp) } co_register_options(chordal_grp); - java_coal_register_options(chordal_grp); + be_java_coal_register_options(chordal_grp); +#ifdef WITH_ILP + be_spill_remat_register_options(chordal_grp); +#endif } #endif /* WITH_LIBCORE */ @@ -372,6 +385,7 @@ static be_ra_timer_t *be_ra_chordal_main(const be_irg_t *bi) ra_timer.t_epilog = lc_timer_register("ra_epilog", "regalloc epilog"); ra_timer.t_live = lc_timer_register("ra_liveness", "be liveness"); ra_timer.t_spill = lc_timer_register("ra_spill", "spiller"); + ra_timer.t_spillslots = lc_timer_register("ra_spillslots", "spillslots"); ra_timer.t_color = lc_timer_register("ra_color", "graph coloring"); ra_timer.t_ifg = lc_timer_register("ra_ifg", "interference graph"); ra_timer.t_copymin = lc_timer_register("ra_copymin", "copy minimization"); @@ -383,6 +397,7 @@ static be_ra_timer_t *be_ra_chordal_main(const be_irg_t *bi) LC_STOP_AND_RESET_TIMER(ra_timer.t_epilog); LC_STOP_AND_RESET_TIMER(ra_timer.t_live); LC_STOP_AND_RESET_TIMER(ra_timer.t_spill); + LC_STOP_AND_RESET_TIMER(ra_timer.t_spillslots); LC_STOP_AND_RESET_TIMER(ra_timer.t_color); LC_STOP_AND_RESET_TIMER(ra_timer.t_ifg); LC_STOP_AND_RESET_TIMER(ra_timer.t_copymin); @@ -430,9 +445,6 @@ static be_ra_timer_t *be_ra_chordal_main(const be_irg_t *bi) /* Perform the following for each register class. */ for (j = 0, m = arch_isa_get_n_reg_class(isa); j < m; ++j) { - FILE *f; - copy_opt_t *co = NULL; - chordal_env.cls = arch_isa_get_reg_class(isa, j); chordal_env.border_heads = pmap_create(); chordal_env.ignore_colors = bitset_malloc(chordal_env.cls->n_regs); @@ -477,8 +489,9 @@ static be_ra_timer_t *be_ra_chordal_main(const be_irg_t *bi) ); dump(BE_CH_DUMP_SPILL, irg, chordal_env.cls, "-spill", dump_ir_block_graph_sched); - be_compute_spill_offsets(&chordal_env); + check_for_memory_operands(&chordal_env); + be_abi_fix_stack_nodes(bi->abi, chordal_env.lv); BE_TIMER_PUSH(ra_timer.t_verify); @@ -573,6 +586,24 @@ static be_ra_timer_t *be_ra_chordal_main(const be_irg_t *bi) bitset_free(chordal_env.ignore_colors); } + BE_TIMER_PUSH(ra_timer.t_spillslots); + + be_coalesce_spillslots(&chordal_env); + dump(BE_CH_DUMP_SPILLSLOTS, irg, NULL, "-spillslots", dump_ir_block_graph_sched); + + BE_TIMER_POP(ra_timer.t_spillslots); + + BE_TIMER_PUSH(ra_timer.t_verify); + + /* verify spillslots */ + if (options.vrfy_option == BE_CH_VRFY_WARN) { + be_verify_spillslots(main_env->arch_env, irg); + } + else if (options.vrfy_option == BE_CH_VRFY_ASSERT) { + assert(be_verify_spillslots(main_env->arch_env, irg) && "Spillslot verification failed"); + } + BE_TIMER_POP(ra_timer.t_verify); + BE_TIMER_PUSH(ra_timer.t_epilog); dump(BE_CH_DUMP_LOWER, irg, NULL, "-spilloff", dump_ir_block_graph_sched);