public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-4375] recog: Improve parser for pattern new compact syntax
@ 2023-10-03 9:20 Andrea Corallo
0 siblings, 0 replies; only message in thread
From: Andrea Corallo @ 2023-10-03 9:20 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:dd1091fe455c1ede5993b4cdf10d0f7c461b86d7
commit r14-4375-gdd1091fe455c1ede5993b4cdf10d0f7c461b86d7
Author: Richard Sandiford <richard.sandiford@arm.com>
Date: Wed Sep 13 14:50:30 2023 +0100
recog: Improve parser for pattern new compact syntax
Hi all,
this is to add support to the new compact pattern syntax for the case
where the constraints do appear unsorted like:
(define_insn "*<optab>si3_insn_uxtw"
[(set (match_operand:DI 0 "register_operand")
(zero_extend:DI (SHIFT_no_rotate:SI
(match_operand:SI 1 "register_operand")
(match_operand:QI 2 "aarch64_reg_or_shift_imm_si"))))]
""
{@ [cons: =0, 2, 1]
[ r, Uss, r] <shift>\\t%w0, %w1, %2
[ r, r, r] <shift>\\t%w0, %w1, %w2
}
[(set_attr "type" "bfx,shift_reg")]
)
Best Regards
Andrea
gcc/Changelog
2023-09-20 Richard Sandiford <richard.sandiford@arm.com>
* gensupport.cc (convert_syntax): Updated to support unordered
constraints in compact syntax.
Diff:
---
gcc/gensupport.cc | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/gcc/gensupport.cc b/gcc/gensupport.cc
index f7164b3214d..7e125e3d8db 100644
--- a/gcc/gensupport.cc
+++ b/gcc/gensupport.cc
@@ -896,19 +896,6 @@ convert_syntax (rtx x, file_location loc)
parse_section_layout (loc, &templ, "cons:", tconvec, true);
- /* Check for any duplicate cons entries and sort based on i. */
- for (auto e : tconvec)
- {
- unsigned idx = e.idx;
- if (idx >= convec.size ())
- convec.resize (idx + 1);
-
- if (convec[idx].idx >= 0)
- fatal_at (loc, "duplicate cons number found: %d", idx);
- convec[idx] = e;
- }
- tconvec.clear ();
-
if (*templ != ']')
{
if (*templ == ';')
@@ -951,13 +938,13 @@ convert_syntax (rtx x, file_location loc)
new_templ += '\n';
new_templ.append (buffer);
/* Parse the constraint list, then the attribute list. */
- if (convec.size () > 0)
- parse_section (&templ, convec.size (), alt_no, convec, loc,
+ if (tconvec.size () > 0)
+ parse_section (&templ, tconvec.size (), alt_no, tconvec, loc,
"constraint");
if (attrvec.size () > 0)
{
- if (convec.size () > 0 && !expect_char (&templ, ';'))
+ if (tconvec.size () > 0 && !expect_char (&templ, ';'))
fatal_at (loc, "expected `;' to separate constraints "
"and attributes in alternative %d", alt_no);
@@ -1027,6 +1014,19 @@ convert_syntax (rtx x, file_location loc)
++alt_no;
}
+ /* Check for any duplicate cons entries and sort based on i. */
+ for (auto e : tconvec)
+ {
+ unsigned idx = e.idx;
+ if (idx >= convec.size ())
+ convec.resize (idx + 1);
+
+ if (convec[idx].idx >= 0)
+ fatal_at (loc, "duplicate cons number found: %d", idx);
+ convec[idx] = e;
+ }
+ tconvec.clear ();
+
/* Write the constraints and attributes into their proper places. */
if (convec.size () > 0)
add_constraints (x, loc, convec);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-10-03 9:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-03 9:20 [gcc r14-4375] recog: Improve parser for pattern new compact syntax Andrea Corallo
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).