X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;ds=sidebyside;f=ir%2Fbe%2Fbemain.c;h=4b109caedefd6fcb133d1ed0abed4ea7f8149f91;hb=505e4b0f5056fdc1553842e138c23572172ce565;hp=7535e5859628a8a3157b7b8120807c64c9b8b69b;hpb=2913f913c5977559bf8405b383b0cc25a83e7589;p=libfirm diff --git a/ir/be/bemain.c b/ir/be/bemain.c index 7535e5859..4b109caed 100644 --- a/ir/be/bemain.c +++ b/ir/be/bemain.c @@ -30,6 +30,7 @@ #include "irloop_t.h" #include "irtools.h" #include "irvrfy.h" +#include "irprintf.h" #include "return.h" #include "firmstat.h" #include "cfopt.h" @@ -41,6 +42,7 @@ #include "arm/bearch_arm.h" #include "ppc32/bearch_ppc32.h" #include "mips/bearch_mips.h" +// #include "sta/bearch_sta.h" #include "be_t.h" #include "benumb_t.h" @@ -123,6 +125,7 @@ static const lc_opt_enum_const_ptr_items_t ra_items[] = { static const lc_opt_enum_const_ptr_items_t isa_items[] = { { "ia32", &ia32_isa_if }, #if 0 + { "sta", &sta_isa_if }, { "arm", &arm_isa_if }, { "ppc32", &ppc32_isa_if }, { "mips", &mips_isa_if }, @@ -215,9 +218,14 @@ void be_opt_register(void) isa->register_options(be_grp_root); } - /* scheduler register options */ + /* list scheduler register options */ list_sched_register_options(be_grp_root); +#ifdef WITH_ILP + /* ilp scheduler register options */ + ilpsched_register_options(be_grp_root); +#endif /* WITH_ILP */ + be_block_schedule_register_options(be_grp_root); } #endif /* WITH_LIBCORE */ @@ -497,11 +505,17 @@ static void be_main_loop(FILE *file_handle, const char *cup_name) ir_graph *irg = birg->irg; optimization_state_t state; const arch_code_generator_if_t *cg_if; + char irg_name[128]; /* set the current graph (this is important for several firm functions) */ current_ir_graph = irg; - be_init_stat_file(be_options.stat_file_name, irg); + if(be_stat_ev_is_active()) { + ir_snprintf(irg_name, sizeof(irg_name), "%F", irg); + be_stat_tags[STAT_TAG_CLS] = ""; + be_stat_tags[STAT_TAG_IRG] = irg_name; + be_stat_ev_push(be_stat_tags, STAT_TAG_LAST, be_stat_file); + } /* stop and reset timers */ BE_TIMER_ONLY( @@ -585,8 +599,8 @@ static void be_main_loop(FILE *file_handle, const char *cup_name) #ifdef WITH_ILP case BE_SCHED_ILP: be_ilp_sched(birg); - fprintf(stderr, "Warning: ILP scheduler not yet fully implemented, falling back to list scheduler.\n"); - list_sched(birg, &be_options); + //fprintf(stderr, "Warning: ILP scheduler not yet fully implemented, falling back to list scheduler.\n"); + //list_sched(birg, &be_options); break; #endif /* WITH_ILP */ }; @@ -636,11 +650,21 @@ static void be_main_loop(FILE *file_handle, const char *cup_name) arch_code_generator_before_ra(birg->cg); BE_TIMER_POP(t_codegen); + if(be_stat_ev_is_active()) { + be_stat_ev_l("costs_before_ra", + (long) be_estimate_irg_costs(irg, env.arch_env, birg->execfreqs)); + } + /* Do register allocation */ BE_TIMER_PUSH(t_regalloc); ra_timer = ra->allocate(birg); BE_TIMER_POP(t_regalloc); + if(be_stat_ev_is_active()) { + be_stat_ev_l("costs_after_ra", + (long) be_estimate_irg_costs(irg, env.arch_env, birg->execfreqs)); + } + dump(DUMP_RA, irg, "-ra", dump_ir_block_graph_sched); be_do_stat_nodes(irg, "06 Register Allocation"); @@ -747,7 +771,9 @@ static void be_main_loop(FILE *file_handle, const char *cup_name) if (! stat_is_active()) free_ir_graph(irg); - be_close_stat_file(); + if(be_stat_ev_is_active()) { + be_stat_ev_pop(); + } } be_profile_free(); be_done_env(&env); @@ -782,20 +808,29 @@ void be_main(FILE *file_handle, const char *cup_name) lc_timer_reset_and_start(t); } + + be_init_stat_file(be_options.stat_file_name, cup_name); #endif /* WITH_LIBCORE */ /* never build code for pseudo irgs */ set_visit_pseudo_irgs(0); be_node_init(); + be_main_loop(file_handle, cup_name); #ifdef WITH_LIBCORE if (be_options.timing == BE_TIME_ON) { lc_timer_stop(t); lc_timer_leave_high_priority(); - printf("%-20s: %lu msec\n", "BEMAINLOOP", lc_timer_elapsed_msec(t)); + if(be_stat_ev_is_active()) { + be_stat_ev_l("backend_time", lc_timer_elapsed_msec(t)); + } else { + printf("%-20s: %lu msec\n", "BEMAINLOOP", lc_timer_elapsed_msec(t)); + } } + + be_close_stat_file(); #endif /* WITH_LIBCORE */ }