public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Richard Sandiford <rsandifo@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-8183] Better const_vector printing Date: Wed, 14 Apr 2021 19:07:00 +0000 (GMT) [thread overview] Message-ID: <20210414190700.3F2113972830@sourceware.org> (raw) https://gcc.gnu.org/g:1fce5932a3af575cd02c1d2b786dd1b39b922ebe commit r11-8183-g1fce5932a3af575cd02c1d2b786dd1b39b922ebe Author: Richard Sandiford <richard.sandiford@arm.com> Date: Wed Apr 14 20:06:44 2021 +0100 Better const_vector printing Looking at PR99929 showed that we weren't dumping enough information about variable-length CONST_VECTORs. Something like: (const_vector:VNx4SI [(const_int 1) (const_int 0)]) could be either: (a) 1, 0, 1, 0, repeating (b) 1 followed by all zeros This patch adds more information to the dumps. There are four cases: (a) above: (const_vector:VNx4SI repeat [ (const_int 1) (const_int 0) ]) (b) above: (const_vector:VNx4SI [ (const_int 1) repeat [ (const_int 0) ] ]) a single stepped sequence: (const_vector:VNx4SI [ (const_int 0) stepped [ (const_int 1) (const_int 2) ] ]) interleaved stepped sequences: (const_vector:VNx4SI [ (const_int 0) (const_int 40) stepped (interleave 2) [ (const_int 1) (const_int 41) (const_int 2) (const_int 42) ] ]) There are probably better syntaxes, but hopefully this is at least an improvement on the status quo. gcc/ * print-rtl.c (rtx_writer::print_rtx_operand_codes_E_and_V): Print more information about variable-length CONST_VECTORs. Diff: --- gcc/print-rtl.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c index c7982bce507..081fc50fab8 100644 --- a/gcc/print-rtl.c +++ b/gcc/print-rtl.c @@ -370,6 +370,10 @@ rtx_writer::print_rtx_operand_codes_E_and_V (const_rtx in_rtx, int idx) print_rtx_head, m_indent * 2, ""); m_sawclose = 0; } + if (GET_CODE (in_rtx) == CONST_VECTOR + && !GET_MODE_NUNITS (GET_MODE (in_rtx)).is_constant () + && CONST_VECTOR_DUPLICATE_P (in_rtx)) + fprintf (m_outfile, " repeat"); fputs (" [", m_outfile); if (XVEC (in_rtx, idx) != NULL) { @@ -377,12 +381,32 @@ rtx_writer::print_rtx_operand_codes_E_and_V (const_rtx in_rtx, int idx) if (XVECLEN (in_rtx, idx)) m_sawclose = 1; + int barrier = XVECLEN (in_rtx, idx); + if (GET_CODE (in_rtx) == CONST_VECTOR + && !GET_MODE_NUNITS (GET_MODE (in_rtx)).is_constant ()) + barrier = CONST_VECTOR_NPATTERNS (in_rtx); + for (int j = 0; j < XVECLEN (in_rtx, idx); j++) { int j1; + if (j == barrier) + { + fprintf (m_outfile, "\n%s%*s", + print_rtx_head, m_indent * 2, ""); + if (!CONST_VECTOR_STEPPED_P (in_rtx)) + fprintf (m_outfile, "repeat ["); + else if (CONST_VECTOR_NPATTERNS (in_rtx) == 1) + fprintf (m_outfile, "stepped ["); + else + fprintf (m_outfile, "stepped (interleave %d) [", + CONST_VECTOR_NPATTERNS (in_rtx)); + m_indent += 2; + } + print_rtx (XVECEXP (in_rtx, idx, j)); - for (j1 = j + 1; j1 < XVECLEN (in_rtx, idx); j1++) + int limit = MIN (barrier, XVECLEN (in_rtx, idx)); + for (j1 = j + 1; j1 < limit; j1++) if (XVECEXP (in_rtx, idx, j) != XVECEXP (in_rtx, idx, j1)) break; @@ -393,6 +417,12 @@ rtx_writer::print_rtx_operand_codes_E_and_V (const_rtx in_rtx, int idx) } } + if (barrier < XVECLEN (in_rtx, idx)) + { + m_indent -= 2; + fprintf (m_outfile, "\n%s%*s]", print_rtx_head, m_indent * 2, ""); + } + m_indent -= 2; } if (m_sawclose)
reply other threads:[~2021-04-14 19:07 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210414190700.3F2113972830@sourceware.org \ --to=rsandifo@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).