This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 00/16] RTL frontend (v3)
- From: David Malcolm <dmalcolm at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: David Malcolm <dmalcolm at redhat dot com>
- Date: Wed, 5 Oct 2016 12:14:54 -0400
- Subject: [PATCH 00/16] RTL frontend (v3)
- Authentication-results: sourceware.org; auth=none
This patch kit is v3 of the RTL frontend. For reference, the earlier
versions were:
v1 (2016-05-04):
"[PATCH 0/4] RFC: RTL frontend"
https://gcc.gnu.org/ml/gcc-patches/2016-05/msg00352.html
v2 (2016-09-08):
"[PATCH 0/9] RFC: selftests based on RTL dumps"
https://gcc.gnu.org/ml/gcc-patches/2016-09/msg00483.html
The patch kit is based on top of r240740 (2016-10-04).
What's new in v3:
* The input file format is now the output format of the recently-added
"print_rtx_function", which emits CFG and crtl information. The
code can now parse that new information and reconstruct it.
The CFG info is optional when parsing, to make it easier to
edit and create input RTL "by hand".
(patch 10 in the kit).
* This version adds back in the "rtl1" frontend, and "rtl.dg" in
the testsuite, capable of running individual passes on RTL dumps.
(patch 15 in the kit).
* Added an rtl-frontend.texi to the gccint docs (patch 15), which
contains additional high-level information.
* This version also implements Richi's idea of using the C frontend:
tagging C functions with "__RTL", and then being able to supply an
RTL dump as the body of the function. This allows for more
interesting decls and types in test cases.
(patch 16 in the kit).
There are thus three forms of dump-reading in this kit:
(a) selftests that read a .rtl file,
(b) rtl.dg tests that read a .rtl file, and
(c) rtl.dg tests that read a .c file
all built on top of class function_reader (and thus sharing most of
their code).
* Previously all of the various dumps in selftests were string
fragments in the pass .c files; they've now been moved to .rtl files
and .c files below the "gcc/testsuite" subdirectory (to
"gcc/testsuite/selftest" and to "gcc/testsuite/rtl.dg"). Tests
have been moved to target-specific subdirectories where appropriate.
* I've split out lots of preliminary material from the bigger patches
(hence this is a 16-patch kit, but hopefully this is easier as a whole
to digest).
* Rewrote how pseudos get renumbered (see rtl-frontend.texi in patch 15
for details).
* Much of the unpleasantness of reading the print_rtx format has been
reduced and contained, by moving the special-case handling of operand
parsing to read-rtl-function.c, and splitting it out into a collection
of short routines, rather than one big one.
* I dropped source locations from the parser for now, for the sake of
simplicity (which means dropping the roundtrip.exp part of rtl.dg).
* Fixed an auto-dependency problem that prevented bootstrap.
* Added a run-one-rtl-pass.c/h (patch 15), to encapsulate the hacks
that appear to be necessary to do this (for rtl1 and for
cc1's __RTL mode).
* Added a prototype of an RTL interpreter, a kind of "valgrind for RTL"
(patch 14) to show how this work could enable such a thing. This
patch is more just an idea than a real implementation at this point.
* More test cases
The patch kit (as a whole) bootstraps and passes regression testing,
on x86_64-pc-linux-gnu, at least, adding a new rtl.sum with 46 PASSes
and 2 unsupported; stage 1 builds and passes selftesting and check-rtl
for target aarch64-linux-gnu.
I'm working on doing a full test across all our supported targets (and
there are likely some target-specific failures in there at the moment).
There are still some FIXMEs, TODOs and #if 0 in there, but I thought
it was worth posting to check that this is moving in the right
direction.
Thoughts?
Dave
David Malcolm (16):
read-md.c: Add various cleanups to ~rtx_reader
(approved) Add selftest::read_file
(approved) selftest.h: add temp_override fixture
(approved) Expose forcibly_ggc_collect and run it after all selftests
Introduce rtl_data::init_stack_alignment
Introduce emit_status::ensure_regno_capacity
read-md: add some helper functions
(partially-approved): Introduce selftest::locate_file
Split class rtx_reader into base_rtx_reader vs rtx_reader
Introduce class function_reader (v3)
df selftests (v3)
combine.c selftests (v2)
cse.c selftests
RTL interpreter (work-in-progress)
RTL frontend (rtl1), on top of dump reader
Add "__RTL" to cc1
gcc/Makefile.in | 14 +-
gcc/c-family/c-common.c | 1 +
gcc/c-family/c-common.h | 3 +
gcc/c/c-parser.c | 102 +-
gcc/cfgexpand.c | 5 +-
gcc/combine.c | 121 +
gcc/common.opt | 6 +-
gcc/cse.c | 70 +
gcc/df-core.c | 73 +
gcc/doc/rtl-frontend.texi | 262 +++
gcc/doc/rtl.texi | 3 +
gcc/emit-rtl.c | 57 +-
gcc/emit-rtl.h | 2 +
gcc/errors.c | 23 +-
gcc/errors.h | 14 +
gcc/function-tests.c | 2 +-
gcc/function.c | 3 +-
gcc/function.h | 2 +
gcc/gcc.c | 1 +
gcc/genpreds.c | 6 +-
gcc/ggc-tests.c | 28 +-
gcc/print-rtl.c | 4 +-
gcc/read-md.c | 220 +-
gcc/read-md.h | 89 +-
gcc/read-rtl-function.c | 2448 ++++++++++++++++++++
gcc/read-rtl-function.h | 40 +
gcc/read-rtl.c | 251 +-
gcc/rtl-interpreter.c | 371 +++
gcc/rtl-interpreter.h | 86 +
gcc/rtl.c | 2 +
gcc/rtl.h | 3 +
gcc/rtl/Make-lang.in | 88 +
gcc/rtl/config-lang.in | 36 +
gcc/rtl/lang-specs.h | 25 +
gcc/rtl/lang.opt | 33 +
gcc/rtl/rtl-errors.c | 34 +
gcc/rtl/rtl-frontend.c | 399 ++++
gcc/run-one-rtl-pass.c | 119 +
gcc/run-one-rtl-pass.h | 25 +
gcc/selftest-rtl.c | 90 +
gcc/selftest-rtl.h | 67 +
gcc/selftest-run-tests.c | 18 +
gcc/selftest.c | 88 +
gcc/selftest.h | 56 +
gcc/testsuite/gcc.dg/cpp/pr71591.c | 2 +-
gcc/testsuite/lib/rtl-dg.exp | 64 +
gcc/testsuite/rtl.dg/aarch64/asr_div1.rtl | 32 +
gcc/testsuite/rtl.dg/aarch64/pr71779.rtl | 44 +
gcc/testsuite/rtl.dg/cfg-extra-bb.rtl | 12 +
gcc/testsuite/rtl.dg/cfg-missing-bb.rtl | 16 +
gcc/testsuite/rtl.dg/good-include.rtl | 6 +
gcc/testsuite/rtl.dg/good-includee.md | 5 +
gcc/testsuite/rtl.dg/missing-include.rtl | 1 +
gcc/testsuite/rtl.dg/more-than-one-cfg.rtl | 7 +
gcc/testsuite/rtl.dg/rtl.exp | 43 +
gcc/testsuite/rtl.dg/test.c | 31 +
gcc/testsuite/rtl.dg/unknown-insn-uid.rtl | 6 +
gcc/testsuite/rtl.dg/unknown-rtx-code.rtl | 5 +
gcc/testsuite/rtl.dg/x86_64/dfinit.rtl | 102 +
gcc/testsuite/rtl.dg/x86_64/different-structs.c | 101 +
gcc/testsuite/rtl.dg/x86_64/final.rtl | 58 +
gcc/testsuite/rtl.dg/x86_64/into-cfglayout.rtl | 91 +
gcc/testsuite/rtl.dg/x86_64/ira.rtl | 91 +
gcc/testsuite/rtl.dg/x86_64/pro_and_epilogue.rtl | 44 +
.../x86_64/test-return-const.c.after-expand.c | 23 +
.../x86_64/test-return-const.c.before-fwprop.c | 27 +
gcc/testsuite/rtl.dg/x86_64/test-rtl.c | 95 +
.../rtl.dg/x86_64/times-two.c.after-expand.c | 40 +
.../rtl.dg/x86_64/times-two.c.before-df.c | 57 +
gcc/testsuite/rtl.dg/x86_64/vregs.rtl | 88 +
gcc/testsuite/selftests/aarch64/times-two.rtl | 42 +
gcc/testsuite/selftests/asr_div1.rtl | 23 +
gcc/testsuite/selftests/cfg-test.rtl | 38 +
gcc/testsuite/selftests/const-int.rtl | 16 +
.../selftests/copy-hard-reg-into-frame.rtl | 12 +
gcc/testsuite/selftests/example-labels.rtl | 6 +
gcc/testsuite/selftests/example.txt | 1 +
gcc/testsuite/selftests/insn-with-mode.rtl | 5 +
gcc/testsuite/selftests/jump-to-label-ref.rtl | 11 +
gcc/testsuite/selftests/jump-to-return.rtl | 10 +
gcc/testsuite/selftests/jump-to-simple-return.rtl | 11 +
gcc/testsuite/selftests/non-combinable-shifts.rtl | 18 +
gcc/testsuite/selftests/note-insn-deleted.rtl | 5 +
gcc/testsuite/selftests/note_insn_basic_block.rtl | 5 +
gcc/testsuite/selftests/pr71779.rtl | 39 +
.../selftests/rtl/interp/empty-function.rtl | 19 +
.../selftests/rtl/interp/simple-arith.rtl | 13 +
gcc/testsuite/selftests/rtl/interp/simple-set.rtl | 7 +
.../selftests/rtl/interp/undefined-read.rtl | 11 +
gcc/testsuite/selftests/simple-cse.rtl | 12 +
gcc/testsuite/selftests/single-set.rtl | 5 +
gcc/testsuite/selftests/symbol-ref.rtl | 7 +
gcc/testsuite/selftests/test-regno-renumbering.rtl | 6 +
gcc/testsuite/selftests/x86_64/call-insn.rtl | 12 +
gcc/testsuite/selftests/x86_64/times-two.rtl | 57 +
gcc/toplev.c | 7 +
gcc/tree-dfa.c | 5 +
97 files changed, 6730 insertions(+), 154 deletions(-)
create mode 100644 gcc/doc/rtl-frontend.texi
create mode 100644 gcc/read-rtl-function.c
create mode 100644 gcc/read-rtl-function.h
create mode 100644 gcc/rtl-interpreter.c
create mode 100644 gcc/rtl-interpreter.h
create mode 100644 gcc/rtl/Make-lang.in
create mode 100644 gcc/rtl/config-lang.in
create mode 100644 gcc/rtl/lang-specs.h
create mode 100644 gcc/rtl/lang.opt
create mode 100644 gcc/rtl/rtl-errors.c
create mode 100644 gcc/rtl/rtl-frontend.c
create mode 100644 gcc/run-one-rtl-pass.c
create mode 100644 gcc/run-one-rtl-pass.h
create mode 100644 gcc/selftest-rtl.c
create mode 100644 gcc/selftest-rtl.h
create mode 100644 gcc/testsuite/lib/rtl-dg.exp
create mode 100644 gcc/testsuite/rtl.dg/aarch64/asr_div1.rtl
create mode 100644 gcc/testsuite/rtl.dg/aarch64/pr71779.rtl
create mode 100644 gcc/testsuite/rtl.dg/cfg-extra-bb.rtl
create mode 100644 gcc/testsuite/rtl.dg/cfg-missing-bb.rtl
create mode 100644 gcc/testsuite/rtl.dg/good-include.rtl
create mode 100644 gcc/testsuite/rtl.dg/good-includee.md
create mode 100644 gcc/testsuite/rtl.dg/missing-include.rtl
create mode 100644 gcc/testsuite/rtl.dg/more-than-one-cfg.rtl
create mode 100644 gcc/testsuite/rtl.dg/rtl.exp
create mode 100644 gcc/testsuite/rtl.dg/test.c
create mode 100644 gcc/testsuite/rtl.dg/unknown-insn-uid.rtl
create mode 100644 gcc/testsuite/rtl.dg/unknown-rtx-code.rtl
create mode 100644 gcc/testsuite/rtl.dg/x86_64/dfinit.rtl
create mode 100644 gcc/testsuite/rtl.dg/x86_64/different-structs.c
create mode 100644 gcc/testsuite/rtl.dg/x86_64/final.rtl
create mode 100644 gcc/testsuite/rtl.dg/x86_64/into-cfglayout.rtl
create mode 100644 gcc/testsuite/rtl.dg/x86_64/ira.rtl
create mode 100644 gcc/testsuite/rtl.dg/x86_64/pro_and_epilogue.rtl
create mode 100644 gcc/testsuite/rtl.dg/x86_64/test-return-const.c.after-expand.c
create mode 100644 gcc/testsuite/rtl.dg/x86_64/test-return-const.c.before-fwprop.c
create mode 100644 gcc/testsuite/rtl.dg/x86_64/test-rtl.c
create mode 100644 gcc/testsuite/rtl.dg/x86_64/times-two.c.after-expand.c
create mode 100644 gcc/testsuite/rtl.dg/x86_64/times-two.c.before-df.c
create mode 100644 gcc/testsuite/rtl.dg/x86_64/vregs.rtl
create mode 100644 gcc/testsuite/selftests/aarch64/times-two.rtl
create mode 100644 gcc/testsuite/selftests/asr_div1.rtl
create mode 100644 gcc/testsuite/selftests/cfg-test.rtl
create mode 100644 gcc/testsuite/selftests/const-int.rtl
create mode 100644 gcc/testsuite/selftests/copy-hard-reg-into-frame.rtl
create mode 100644 gcc/testsuite/selftests/example-labels.rtl
create mode 100644 gcc/testsuite/selftests/example.txt
create mode 100644 gcc/testsuite/selftests/insn-with-mode.rtl
create mode 100644 gcc/testsuite/selftests/jump-to-label-ref.rtl
create mode 100644 gcc/testsuite/selftests/jump-to-return.rtl
create mode 100644 gcc/testsuite/selftests/jump-to-simple-return.rtl
create mode 100644 gcc/testsuite/selftests/non-combinable-shifts.rtl
create mode 100644 gcc/testsuite/selftests/note-insn-deleted.rtl
create mode 100644 gcc/testsuite/selftests/note_insn_basic_block.rtl
create mode 100644 gcc/testsuite/selftests/pr71779.rtl
create mode 100644 gcc/testsuite/selftests/rtl/interp/empty-function.rtl
create mode 100644 gcc/testsuite/selftests/rtl/interp/simple-arith.rtl
create mode 100644 gcc/testsuite/selftests/rtl/interp/simple-set.rtl
create mode 100644 gcc/testsuite/selftests/rtl/interp/undefined-read.rtl
create mode 100644 gcc/testsuite/selftests/simple-cse.rtl
create mode 100644 gcc/testsuite/selftests/single-set.rtl
create mode 100644 gcc/testsuite/selftests/symbol-ref.rtl
create mode 100644 gcc/testsuite/selftests/test-regno-renumbering.rtl
create mode 100644 gcc/testsuite/selftests/x86_64/call-insn.rtl
create mode 100644 gcc/testsuite/selftests/x86_64/times-two.rtl
--
1.8.5.3