diff options
author | Richard Henderson <rth@cygnus.com> | 1999-08-31 13:37:09 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 1999-08-31 13:37:09 -0700 |
commit | ede7cd44999a94c3eeb6708db37d6939045b554e (patch) | |
tree | afdcdc35501714ae0479a8139d1ee32d313b0176 /gcc/toplev.c | |
parent | 4dfeccf9d064821bede6f09da2949499f19c68c4 (diff) | |
download | gcc-ede7cd44999a94c3eeb6708db37d6939045b554e.zip gcc-ede7cd44999a94c3eeb6708db37d6939045b554e.tar.gz gcc-ede7cd44999a94c3eeb6708db37d6939045b554e.tar.bz2 |
backport: Makefile.in (STAGESTUFF): Add *.peephole2.
Merge peephole2 from new_ia32_branch:
* Makefile.in (STAGESTUFF): Add *.peephole2.
(mostlyclean): Likewise.
(recog.o): Depend on resource.h.
* final.c (peephole): Conditionalize decl on HAVE_peephole.
(final_scan_insn): Likewise for the invocation of peephole.
* genconfig.c (main): Look for peephole and peephole2 patterns.
Emit HAVE_peephole* accordingly.
* genpeep.c (main): Conditionalize entire output on HAVE_peephole.
* flags.h (flag_peephole2): Declare.
* toplev.c: New pass peephole2. New flag -fpeephole2.
* genattrtab.c (main): Count DEFINE_PEEPHOLE2.
* gencodes.c (main): Likewise.
* genextract.c (main): Likewise.
* genoutput.c (main): Likewise.
* genemit.c (max_operand_1): Look for the max scratch operand.
(gen_rtx_scratch): New.
(gen_exp): Use it, and pass on new arg subroutine_type.
(gen_expand): Take max scratch into account.
(gen_split): Emit peephole2 functions.
(output_peephole2_scratch): New.
(main): Include hard-reg-set.h and resource.h. Handle peephole2.
* genrecog.c (routine_type): Add PEEPHOLE2.
(IS_SPLIT): New.
(make_insn_sequence): Match outer parallel for peep2. Discard
top level scratches and dups.
(add_to_sequence): New args insn_type and top. Update all callers.
Handle toplevel peep2 matching insns.
(write_subroutine): Handle peep2.
(write_tree_1): Likewise.
(write_tree): Likewise.
(main): Likewise.
(change_state): New arg afterward. Update all callers.
Handle matching separate insns.
* recog.c (recog_next_insn): New.
(peephole2_optimize): New.
* rtl.def (DEFINE_PEEPHOLE2): New.
* resource.c (find_free_register): New argument last_insn. Use it
to find a register available through the entire span.
* resource.h (find_free_register): Update prototype.
From-SVN: r29015
Diffstat (limited to 'gcc/toplev.c')
-rw-r--r-- | gcc/toplev.c | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/gcc/toplev.c b/gcc/toplev.c index 532c98b..a3017b7 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -290,6 +290,7 @@ int sched_dump = 0; int local_reg_dump = 0; int global_reg_dump = 0; int flow2_dump = 0; +int peephole2_dump = 0; int sched2_dump = 0; int jump2_opt_dump = 0; #ifdef DELAY_SLOTS @@ -761,6 +762,9 @@ int flag_instrument_function_entry_exit = 0; int flag_no_ident = 0; +/* This will perform a peephole pass before sched2. */ +int flag_peephole2 = 0; + /* Table of supported debugging formats. */ static struct { @@ -966,7 +970,9 @@ lang_independent_options f_options[] = {"leading-underscore", &flag_leading_underscore, 1, "External symbols have a leading underscore" }, {"ident", &flag_no_ident, 0, - "Process #ident directives"} + "Process #ident directives"}, + { "peephole2", &flag_peephole2, 1, + "Enables an rtl peephole pass run before sched2" } }; #define NUM_ELEM(a) (sizeof (a) / sizeof ((a)[0])) @@ -3004,6 +3010,12 @@ compile_file (name) if (graph_dump_format != no_graph) clean_graph_dump_file (dump_base_name, ".flow2"); } + if (peephole2_dump) + { + clean_dump_file (".peephole2"); + if (graph_dump_format != no_graph) + clean_graph_dump_file (dump_base_name, ".peephole2"); + } if (sched2_dump) { clean_dump_file (".sched2"); @@ -4226,6 +4238,23 @@ rest_of_compilation (decl) print_rtl_graph_with_bb (dump_base_name, ".flow2", insns); } +#ifdef HAVE_peephole2 + if (optimize > 0 && flag_peephole2) + { + if (peephole2_dump) + open_dump_file (".peephole2", decl_printable_name (decl, 2)); + + peephole2_optimize (rtl_dump_file); + + if (peephole2_dump) + { + close_dump_file (print_rtl_with_bb, insns); + if (graph_dump_format != no_graph) + print_rtl_graph_with_bb (dump_base_name, ".peephole2", insns); + } + } +#endif + if (optimize > 0 && flag_schedule_insns_after_reload) { if (sched2_dump) @@ -4822,6 +4851,7 @@ main (argc, argv) flag_rerun_loop_opt = 1; flag_caller_saves = 1; flag_force_mem = 1; + flag_peephole2 = 1; #ifdef INSN_SCHEDULING flag_schedule_insns = 1; flag_schedule_insns_after_reload = 1; @@ -4917,6 +4947,7 @@ main (argc, argv) #ifdef MACHINE_DEPENDENT_REORG mach_dep_reorg_dump = 1; #endif + peephole2_dump = 1; break; case 'A': flag_debug_asm = 1; @@ -4996,11 +5027,14 @@ main (argc, argv) case 'w': flow2_dump = 1; break; + case 'x': + rtl_dump_and_exit = 1; + break; case 'y': set_yydebug (1); break; - case 'x': - rtl_dump_and_exit = 1; + case 'z': + peephole2_dump = 1; break; case 'D': /* these are handled by the preprocessor */ case 'I': |