On Wed, 2016-10-12 at 19:31 +0200, Bernd Schmidt wrote:
> On 10/12/2016 07:48 PM, David Malcolm wrote:

[...snip...]

> > I think the only remaining item from our discussion above is what
> > to do
> > about the numbering of pseudos in the dumps (currently it just
> > prints the regno
> > unmodified).
> >
> > Other than that, is the resultant dump format good enough that I
> > can start
> > rewriting the RTL frontend parser, or are there other changes you'd
> > want?
>
> Give me a day or two to think it over, and for others to chime in.
> But I
> think this is reasonably close to what it should look like. Maybe
> empty
> edge flags don't need to be printed, and possibly there could be a
> more
> compact format for a large number edges like what you have for the
> switch?

[...snip...]

This patch implements:
* the renumbering of non-virtual pseudos, using
  LAST_VIRTUAL_REGISTER + 1 as a base.
* omitting the edge "(flags)" directive if there aren't any

Bootstrap & regrtest in progress.

OK for trunk if they pass?

gcc/ChangeLog:
        * print-rtl-function.c (print_edge): Omit "(flags)" when none are
        set.
        * print-rtl.c (print_rtx_operand_code_r): In compact mode, print
        pseudos offset by (LAST_VIRTUAL_REGISTER + 1), so that the first
        non-virtual pseudo is 0.
---
 gcc/print-rtl-function.c | 13 +++++++++----
 gcc/print-rtl.c          |  8 ++++++++
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/gcc/print-rtl-function.c b/gcc/print-rtl-function.c
index 90a0ff7..770cee3 100644
--- a/gcc/print-rtl-function.c
+++ b/gcc/print-rtl-function.c
@@ -59,9 +59,11 @@ print_edge (FILE *outfile, edge e, bool from)
 
   /* Express edge flags as a string with " | " separator.
      e.g. (flags "FALLTHRU | DFS_BACK").  */
-  fprintf (outfile, " (flags \"");
-  bool seen_flag = false;
-#define DEF_EDGE_FLAG(NAME,IDX) \
+  if (e->flags)
+    {
+      fprintf (outfile, " (flags \"");
+      bool seen_flag = false;
+#define DEF_EDGE_FLAG(NAME,IDX)                        \
   do {                                         \
     if (e->flags & EDGE_##NAME)                        \
       {                                                \
@@ -74,7 +76,10 @@ print_edge (FILE *outfile, edge e, bool from)
 #include "cfg-flags.def"
 #undef DEF_EDGE_FLAG
 
-  fprintf (outfile, "\"))\n");
+      fprintf (outfile, "\")");
+    }
+
+  fprintf (outfile, ")\n");
 }
 
 /* If BB is non-NULL, print the start of a "(block)" directive for it
diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c
index f114cb4..86816b5 100644
--- a/gcc/print-rtl.c
+++ b/gcc/print-rtl.c
@@ -400,6 +400,14 @@ print_rtx_operand_code_r (const_rtx in_rtx)
 #endif
     if (flag_dump_unnumbered && is_insn)
       fputc ('#', outfile);
+    else if (flag_compact)
+      {
+       /* In compact mode, print pseudos offset by
+          (LAST_VIRTUAL_REGISTER + 1), so that the first non-virtual pseudo
+          is dumped as 0.  */
+       gcc_assert (regno > LAST_VIRTUAL_REGISTER);
+       fprintf (outfile, " %d", regno - (LAST_VIRTUAL_REGISTER + 1));
+      }
     else
       fprintf (outfile, " %d", regno);
 
-- 
1.8.5.3

Reply via email to