On Fri, 2016-12-16 at 10:32 -0500, David Malcolm wrote: > On Fri, 2016-12-16 at 14:28 +0100, Bernd Schmidt wrote: > > On 12/14/2016 05:57 PM, David Malcolm wrote: > > > Any preferences? (or other syntax ideas?). My preference is one > > > of > > > the > > > currently-unused sigils e.g. "@3", or to wrap them in braces > > > "{3}". > > > > Either might work, I'd vaguely prefer <3> over {3} but they're > > equivalent really. Maybe using "@" is simplest if it's unused. > > I mostly implemented @, but ran into an issue: it leads to lexer > errors > when parsing "__RTL"-tagged functions within cc1, where the lexer > complains about the stray CPP_ATSIGN token: > > gcc.dg/rtl/aarch64/asr_div1.c:12:25: error: stray '@' in program > > We could add a flag to the preprocessor to support this token when > within c_parser_parse_rtl_body, but it seems simpler to just use a > different syntax: '<3>'. I'm working on the '<3>' syntax. > > Dave
I've implemented the "(reg:SI <3>)" syntax, and created updates to the remaining parts of the patch kit to use it. Successfully built stage1 and ran the selftests for all 191 targets in config-list.mk (for the combined patch kit) - so it looks like this syntax works for all of our supported targets. The following patch implements the change for print-rtl.c. OK for trunk assuming it passes bootstrap®rtest? gcc/ChangeLog: * print-rtl.c (rtx_writer::print_rtx_operand_code_r): For non-virtual pseudos in compact mode, wrap the regno in '<' and '>' rather than using a '%' prefix. * rtl-tests.c (selftest::test_dumping_regs): Update for above change. --- gcc/print-rtl.c | 8 ++++---- gcc/rtl-tests.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c index 77e6b05..d36589e 100644 --- a/gcc/print-rtl.c +++ b/gcc/print-rtl.c @@ -481,11 +481,11 @@ rtx_writer::print_rtx_operand_code_r (const_rtx in_rtx) fputc ('#', m_outfile); else if (m_compact) { - /* In compact mode, print pseudos with a '%' sigil following - by the regno, offset by (LAST_VIRTUAL_REGISTER + 1), so that the - first non-virtual pseudo is dumped as "%0". */ + /* In compact mode, print pseudos with '< and '>' wrapping the regno, + offseting it by (LAST_VIRTUAL_REGISTER + 1), so that the + first non-virtual pseudo is dumped as "<0>". */ gcc_assert (regno > LAST_VIRTUAL_REGISTER); - fprintf (m_outfile, " %%%d", regno - (LAST_VIRTUAL_REGISTER + 1)); + fprintf (m_outfile, " <%d>", regno - (LAST_VIRTUAL_REGISTER + 1)); } else fprintf (m_outfile, " %d", regno); diff --git a/gcc/rtl-tests.c b/gcc/rtl-tests.c index bd918a7..07ceac7 100644 --- a/gcc/rtl-tests.c +++ b/gcc/rtl-tests.c @@ -104,9 +104,9 @@ test_dumping_regs () } /* Test dumping of non-virtual pseudos. */ - ASSERT_RTL_DUMP_EQ ("(reg:SI %0)", + ASSERT_RTL_DUMP_EQ ("(reg:SI <0>)", gen_raw_REG (SImode, LAST_VIRTUAL_REGISTER + 1)); - ASSERT_RTL_DUMP_EQ ("(reg:SI %1)", + ASSERT_RTL_DUMP_EQ ("(reg:SI <1>)", gen_raw_REG (SImode, LAST_VIRTUAL_REGISTER + 2)); } -- 1.8.5.3