From: "H.J. Lu" <hongjiu.lu@intel.com>
To: gcc-patches@gcc.gnu.org
Subject: RFC: PATCH: Remove 26 element limit in vector
Date: Wed, 30 Mar 2011 18:55:00 -0000 [thread overview]
Message-ID: <20110330180925.GA1243@intel.com> (raw)
In-Reply-To: <20110330150238.GA18279@intel.com>
On Wed, Mar 30, 2011 at 08:02:38AM -0700, H.J. Lu wrote:
> Hi,
>
> Currently, we limit XVECEXP to 26 elements in machine description
> since we use letters 'a' to 'z' to encode them. I don't see any
> reason why we can't go beyond 'z'. This patch removes this restriction.
> Any comments?
>
That was wrong. The problem is in vector elements. This patch passes
bootstrap. Any comments?
Thanks.
H.J.
---
2011-03-30 H.J. Lu <hongjiu.lu@intel.com>
* genrecog.c (VECTOR_ELEMENT_BASE): New.
(add_to_sequence): Add assert. Use VECTOR_ELEMENT_BASE to
encode vector elements.
(change_state): Check and support VECTOR_ELEMENT_BASE.
(make_insn_sequence): Add assert.
diff --git a/gcc/genrecog.c b/gcc/genrecog.c
index 74dd0a7..40e9c4d 100644
--- a/gcc/genrecog.c
+++ b/gcc/genrecog.c
@@ -465,6 +465,9 @@ extern void debug_decision
(struct decision *);
extern void debug_decision_list
(struct decision *);
+
+/* The base of vector element. */
+#define VECTOR_ELEMENT_BASE 0x80
\f
/* Create a new node in sequence after LAST. */
@@ -912,6 +915,7 @@ add_to_sequence (rtx pattern, struct decision_head *last, const char *position,
/* Which insn we're looking at is represented by A-Z. We don't
ever use 'A', however; it is always implied. */
+ gcc_assert (i < 26);
subpos[depth] = (i > 0 ? 'A' + i : 0);
sub = add_to_sequence (XVECEXP (pattern, 0, i),
last, subpos, insn_type, 0);
@@ -1002,6 +1006,9 @@ add_to_sequence (rtx pattern, struct decision_head *last, const char *position,
char base = (was_code == MATCH_OPERATOR ? '0' : 'a');
for (i = 0; i < (size_t) XVECLEN (pattern, 2); i++)
{
+ gcc_assert (was_code == MATCH_OPERATOR
+ ? ISDIGIT (i + base)
+ : ISLOWER (i + base));
subpos[depth] = i + base;
sub = add_to_sequence (XVECEXP (pattern, 2, i),
&sub->success, subpos, insn_type, 0);
@@ -1102,7 +1109,9 @@ add_to_sequence (rtx pattern, struct decision_head *last, const char *position,
int j;
for (j = 0; j < XVECLEN (pattern, i); j++)
{
- subpos[depth] = 'a' + j;
+ int val = j + VECTOR_ELEMENT_BASE;
+ gcc_assert (val <= UCHAR_MAX);
+ subpos[depth] = val;
sub = add_to_sequence (XVECEXP (pattern, i, j),
&sub->success, subpos, insn_type, 0);
}
@@ -1779,6 +1788,10 @@ change_state (const char *oldpos, const char *newpos, const char *indent)
else if (ISLOWER (newpos[depth]))
printf ("%sx%d = XVECEXP (x%d, 0, %d);\n",
indent, depth + 1, depth, newpos[depth] - 'a');
+ else if (((unsigned char) newpos[depth]) >= VECTOR_ELEMENT_BASE)
+ printf ("%sx%d = XVECEXP (x%d, 0, %d);\n",
+ indent, depth + 1, depth,
+ ((unsigned char) newpos[depth]) - VECTOR_ELEMENT_BASE);
else
printf ("%sx%d = XEXP (x%d, %c);\n",
indent, depth + 1, depth, newpos[depth]);
@@ -2528,6 +2541,7 @@ make_insn_sequence (rtx insn, enum routine_type type)
}
XVECLEN (x, 0) = j;
+ gcc_assert ((j - 1) < 26);
c_test_pos[0] = 'A' + j - 1;
c_test_pos[1] = '\0';
}
next prev parent reply other threads:[~2011-03-30 18:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-30 15:05 RFC: PATCH: Remove 26 element limit in XVECEXP H.J. Lu
2011-03-30 18:55 ` H.J. Lu [this message]
2011-03-31 8:47 ` RFC: PATCH: Remove 26 element limit in vector Richard Guenther
2011-03-31 9:58 ` Richard Sandiford
2011-03-31 10:20 ` Mike Stump
2011-03-31 12:14 ` Kenneth Zadeck
2011-04-05 1:05 ` H.J. Lu
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=20110330180925.GA1243@intel.com \
--to=hongjiu.lu@intel.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=hjl.tools@gmail.com \
/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: link
Be 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).