From: Kyrylo Tkachov <[email protected]>
Every define_split and define_peephole2 generator opens by announcing
itself to the dump file:
if (dump_file)
fprintf (dump_file, "Splitting with gen_split_9 (aarch64.md:2772)\n");
That is a test and a call in each of 4189 functions on aarch64, 414127
bytes of insn-emit-*.cc, to say something that differs only in the name
and the location. Put the test and the call in emit-rtl.cc, next to
expand_rtx and complete_seq, and pass the part that varies:
note_split ("gen_split_9 (aarch64.md:2772)");
The dump text is unchanged, which matters because scan-rtl-dump tests
match on it.
insn-emit-*.cc goes from 12977106 bytes to 12792702 and compiles in 5% less
time, with peak memory 387MB against 424MB.
Bootstrapped on aarch64-none-linux-gnu.
Ok for trunk?
gcc/ChangeLog:
* rtl.h (note_split): Declare.
* emit-rtl.cc (note_split): New function.
* genemit.cc (gen_split): Call it rather than emitting the test and
the fprintf.
Signed-off-by: Kyrylo Tkachov <[email protected]>
---
gcc/emit-rtl.cc | 12 ++++++++++++
gcc/genemit.cc | 3 +--
gcc/rtl.h | 1 +
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/gcc/emit-rtl.cc b/gcc/emit-rtl.cc
index 4a23eaefe02..08e58ce962d 100644
--- a/gcc/emit-rtl.cc
+++ b/gcc/emit-rtl.cc
@@ -7092,6 +7092,18 @@ complete_seq (const uint8_t *seq, rtx *operands)
return end_sequence ();
}
+/* Note in the dump file that WHAT, which names a define_split or a
+ define_peephole2 and where it came from, is being applied. genemit.cc
+ emits a call to this rather than the test and the fprintf, so that the
+ dump is written out once instead of once per pattern. */
+
+void
+note_split (const char *what)
+{
+ if (dump_file)
+ fprintf (dump_file, "Splitting with %s\n", what);
+}
+
/* Initialize fields of rtl_data related to stack alignment. */
void
diff --git a/gcc/genemit.cc b/gcc/genemit.cc
index 6323aeb19fc..d1dfb296629 100644
--- a/gcc/genemit.cc
+++ b/gcc/genemit.cc
@@ -600,8 +600,7 @@ gen_split (const md_rtx_info &info, FILE *file)
if (*p == '/')
fn = p + 1;
- fprintf (file, " if (dump_file)\n");
- fprintf (file, " fprintf (dump_file, \"Splitting with gen_%s_%d
(%s:%d)\\n\");\n",
+ fprintf (file, " note_split (\"gen_%s_%d (%s:%d)\");\n",
name, info.index, fn, info.loc.lineno);
fprintf (file, " start_sequence ();\n");
diff --git a/gcc/rtl.h b/gcc/rtl.h
index aa0b4c77a39..d305e15a1d1 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -3080,6 +3080,7 @@ enum class expand_opcode {
extern rtx expand_rtx (const uint8_t *, rtx *);
extern rtx_insn *complete_seq (const uint8_t *, rtx *);
+extern void note_split (const char *);
extern rtx copy_rtx_if_shared (rtx);
/* In rtl.cc */
--
2.50.1 (Apple Git-155)