diff options
Diffstat (limited to 'gcc/toplev.c')
-rw-r--r-- | gcc/toplev.c | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/gcc/toplev.c b/gcc/toplev.c index 43be973bcbe..790a51b8fd8 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -245,6 +245,7 @@ int cse2_dump = 0; int branch_prob_dump = 0; int flow_dump = 0; int combine_dump = 0; +int regmove_dump = 0; int sched_dump = 0; int local_reg_dump = 0; int global_reg_dump = 0; @@ -566,6 +567,35 @@ int flag_pedantic_errors = 0; int flag_schedule_insns = 0; int flag_schedule_insns_after_reload = 0; +#ifdef HAIFA +/* The following flags have effect only for scheduling before register + allocation: + + flag_schedule_interblock means schedule insns accross basic blocks. + flag_schedule_speculative means allow speculative motion of non-load insns. + flag_schedule_speculative_load means allow speculative motion of some + load insns. + flag_schedule_speculative_load_dangerous allows speculative motion of more + load insns. + flag_schedule_reverse_before_reload means try to reverse original order + of insns (S). + flag_schedule_reverse_after_reload means try to reverse original order + of insns (R). */ + +int flag_schedule_interblock = 1; +int flag_schedule_speculative = 1; +int flag_schedule_speculative_load = 0; +int flag_schedule_speculative_load_dangerous = 0; +int flag_schedule_reverse_before_reload = 0; +int flag_schedule_reverse_after_reload = 0; + + +/* flag_on_branch_count_reg means try to replace add-1,compare,branch tupple + by a cheaper branch, on a count register. */ +int flag_branch_on_count_reg; +#endif /* HAIFA */ + + /* -finhibit-size-directive inhibits output of .size for ELF. This is used only for compiling crtstuff.c, and it may be extended to other effects @@ -616,6 +646,8 @@ int flag_check_memory_usage = 0; -fcheck-memory-usage. */ int flag_prefix_function_name = 0; +int flag_regmove = 0; + /* 1 if alias checking is on (by default, when -O). */ int flag_alias_check = 0; @@ -666,6 +698,15 @@ struct { char *string; int *variable; int on_value;} f_options[] = {"pretend-float", &flag_pretend_float, 1}, {"schedule-insns", &flag_schedule_insns, 1}, {"schedule-insns2", &flag_schedule_insns_after_reload, 1}, +#ifdef HAIFA + {"sched-interblock",&flag_schedule_interblock, 1}, + {"sched-spec",&flag_schedule_speculative, 1}, + {"sched-spec-load",&flag_schedule_speculative_load, 1}, + {"sched-spec-load-dangerous",&flag_schedule_speculative_load_dangerous, 1}, + {"sched-reverse-S",&flag_schedule_reverse_before_reload, 1}, + {"sched-reverse-R",&flag_schedule_reverse_after_reload, 1}, + {"branch-count-reg",&flag_branch_on_count_reg, 1}, +#endif /* HAIFA */ {"pic", &flag_pic, 1}, {"PIC", &flag_pic, 2}, {"exceptions", &flag_exceptions, 1}, @@ -680,6 +721,7 @@ struct { char *string; int *variable; int on_value;} f_options[] = {"function-sections", &flag_function_sections, 1}, {"verbose-asm", &flag_verbose_asm, 1}, {"gnu-linker", &flag_gnu_linker, 1}, + {"regmove", &flag_regmove, 1}, {"pack-struct", &flag_pack_struct, 1}, {"stack-check", &flag_stack_check, 1}, {"bytecode", &output_bytecode, 1}, @@ -885,6 +927,7 @@ FILE *cse2_dump_file; FILE *branch_prob_dump_file; FILE *flow_dump_file; FILE *combine_dump_file; +FILE *regmove_dump_file; FILE *sched_dump_file; FILE *local_reg_dump_file; FILE *global_reg_dump_file; @@ -905,6 +948,7 @@ int cse2_time; int branch_prob_time; int flow_time; int combine_time; +int regmove_time; int sched_time; int local_alloc_time; int global_alloc_time; @@ -1053,6 +1097,8 @@ fatal_insn (message, insn) fflush (flow_dump_file); if (combine_dump_file) fflush (combine_dump_file); + if (regmove_dump_file) + fflush (regmove_dump_file); if (sched_dump_file) fflush (sched_dump_file); if (local_reg_dump_file) @@ -2131,6 +2177,7 @@ compile_file (name) branch_prob_time = 0; flow_time = 0; combine_time = 0; + regmove_time = 0; sched_time = 0; local_alloc_time = 0; global_alloc_time = 0; @@ -2229,6 +2276,10 @@ compile_file (name) if (combine_dump) combine_dump_file = open_dump_file (dump_base_name, ".combine"); + /* If regmove dump desired, open the output file. */ + if (regmove_dump) + regmove_dump_file = open_dump_file (dump_base_name, ".regmove"); + /* If scheduling dump desired, open the output file. */ if (sched_dump) sched_dump_file = open_dump_file (dump_base_name, ".sched"); @@ -2713,6 +2764,9 @@ compile_file (name) fclose (combine_dump_file); } + if (regmove_dump) + fclose (regmove_dump_file); + if (sched_dump) fclose (sched_dump_file); @@ -2765,6 +2819,7 @@ compile_file (name) print_time ("branch-prob", branch_prob_time); print_time ("flow", flow_time); print_time ("combine", combine_time); + print_time ("regmove", regmove_time); print_time ("sched", sched_time); print_time ("local-alloc", local_alloc_time); print_time ("global-alloc", global_alloc_time); @@ -3304,6 +3359,26 @@ rest_of_compilation (decl) fflush (combine_dump_file); }); + if (regmove_dump) + TIMEVAR (dump_time, + { + fprintf (regmove_dump_file, "\n;; Function %s\n\n", + (*decl_printable_name) (decl, 2)); + }); + + /* Register allocation pre-pass, to reduce number of moves + necessary for two-address machines. */ + if (optimize > 0 && flag_regmove) + TIMEVAR (regmove_time, regmove_optimize (insns, max_reg_num (), + regmove_dump_file)); + + if (regmove_dump) + TIMEVAR (dump_time, + { + print_rtl (regmove_dump_file, insns); + fflush (regmove_dump_file); + }); + /* Print function header into sched dump now because doing the sched analysis makes some of the dump. */ @@ -3703,6 +3778,7 @@ main (argc, argv, envp) flag_schedule_insns = 1; flag_schedule_insns_after_reload = 1; #endif + flag_regmove = 1; } if (optimize >= 3) @@ -3764,6 +3840,7 @@ main (argc, argv, envp) jump2_opt_dump = 1; local_reg_dump = 1; loop_dump = 1; + regmove_dump = 1; rtl_dump = 1; cse_dump = 1, cse2_dump = 1; sched_dump = 1; @@ -3815,6 +3892,9 @@ main (argc, argv, envp) case 't': cse2_dump = 1; break; + case 'N': + regmove_dump = 1; + break; case 'S': sched_dump = 1; break; @@ -3862,6 +3942,18 @@ main (argc, argv, envp) if (found) ; +#ifdef HAIFA +#ifdef INSN_SCHEDULING + else if (!strncmp (p, "sched-verbose-",14)) + fix_sched_param("verbose",&p[14]); + else if (!strncmp (p, "sched-max-",10)) + fix_sched_param("max",&p[10]); + else if (!strncmp (p, "sched-inter-max-b-",18)) + fix_sched_param("interblock-max-blocks",&p[18]); + else if (!strncmp (p, "sched-inter-max-i-",18)) + fix_sched_param("interblock-max-insns",&p[18]); +#endif +#endif /* HAIFA */ else if (!strncmp (p, "fixed-", 6)) fix_register (&p[6], 1, 1); else if (!strncmp (p, "call-used-", 10)) |