On 11/09/18 23:45, Jeff Law wrote:
On 9/5/18 5:49 AM, a...@codesourcery.com wrote:
GCN's 64-lane vectors tend to make RTL dumps very long. This patch makes them
far more bearable by eliding long sequences of the same element into "repeated"
messages.
2018-09-05 Andrew Stubbs <a...@codesourcery.com>
Jan Hubicka <j...@suse.cz>
Martin Jambor <mjam...@suse.cz>
* print-rtl.c (print_rtx_operand_codes_E_and_V): Print how many times
the same elements are repeated rather than printing all of them.
Does this need a corresponding change to the RTL front-end so that it
can read the new form?
Here's an updated patch incorporating the RTL front-end changes. I had
to change from "repeated 2x" to "repeated x2" because the former is not
a valid C token, and apparently that's important.
I've confirmed that it can read RTL and that subsequent dumps look correct.
OK?
Andrew
Elide repeated RTL elements.
GCN's 64-lane vectors tend to make RTL dumps very long. This patch makes them
far more bearable by eliding long sequences of the same element into "repeated"
messages.
This also takes care of reading repeated sequences in the RTL front-end.
2018-09-19 Andrew Stubbs <a...@codesourcery.com>
Jan Hubicka <j...@suse.cz>
Martin Jambor <mjam...@suse.cz>
gcc.
* print-rtl.c (print_rtx_operand_codes_E_and_V): Print how many times
the same elements are repeated rather than printing all of them.
* read-rtl.c (rtx_reader::read_rtx_operand): Recognize and expand
"repeated" elements.
diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c
index 5dd2e31..1228483 100644
--- a/gcc/print-rtl.c
+++ b/gcc/print-rtl.c
@@ -370,7 +370,20 @@ rtx_writer::print_rtx_operand_codes_E_and_V (const_rtx in_rtx, int idx)
m_sawclose = 1;
for (int j = 0; j < XVECLEN (in_rtx, idx); j++)
- print_rtx (XVECEXP (in_rtx, idx, j));
+ {
+ int j1;
+
+ print_rtx (XVECEXP (in_rtx, idx, j));
+ for (j1 = j + 1; j1 < XVECLEN (in_rtx, idx); j1++)
+ if (XVECEXP (in_rtx, idx, j) != XVECEXP (in_rtx, idx, j1))
+ break;
+
+ if (j1 != j + 1)
+ {
+ fprintf (m_outfile, " repeated x%i", j1 - j);
+ j = j1 - 1;
+ }
+ }
m_indent -= 2;
}
diff --git a/gcc/read-rtl.c b/gcc/read-rtl.c
index 723c3e1..7ede18f 100644
--- a/gcc/read-rtl.c
+++ b/gcc/read-rtl.c
@@ -1690,6 +1690,8 @@ rtx_reader::read_rtx_operand (rtx return_rtx, int idx)
struct obstack vector_stack;
int list_counter = 0;
rtvec return_vec = NULL_RTVEC;
+ rtx saved_rtx = NULL_RTX;
+ int repeat_count = 0;
require_char_ws ('[');
@@ -1700,8 +1702,34 @@ rtx_reader::read_rtx_operand (rtx return_rtx, int idx)
if (c == EOF)
fatal_expected_char (']', c);
unread_char (c);
+
+ rtx value;
+ if (repeat_count <= 0 && c == 'r')
+ {
+ /* Process "repeated Nx" directive. */
+ read_name (&name);
+ if (strcmp (name.string, "repeated"))
+ fatal_with_file_and_line ("invalid directive \"%s\"\n",
+ name.string);
+ read_name (&name);
+ if (!sscanf (name.string, "x%d", &repeat_count))
+ fatal_with_file_and_line ("invalid repeat count \"%s\"\n",
+ name.string);
+
+ /* We already saw one of the instances. */
+ repeat_count--;
+ }
+ if (repeat_count > 0)
+ {
+ repeat_count--;
+ value = saved_rtx;
+ }
+ else
+ value = read_nested_rtx ();
+
list_counter++;
- obstack_ptr_grow (&vector_stack, read_nested_rtx ());
+ obstack_ptr_grow (&vector_stack, value);
+ saved_rtx = value;
}
if (list_counter > 0)
{