Commit 085e8246 by Alan Hayward Committed by Alan Hayward

Support >26 operands in generation code.

2018-02-07  Alan Hayward  <alan.hayward@arm.com>

        * genextract.c (push_pathstr_operand): New function to support [a-zA-Z].
        (walk_rtx): Call push_pathstr_operand.
        (print_path): Support [a-zA-Z].

From-SVN: r257455
parent 828ca2ed
2018-02-07 Alan Hayward <alan.hayward@arm.com>
* genextract.c (push_pathstr_operand): New function to support
[a-zA-Z].
(walk_rtx): Call push_pathstr_operand.
(print_path): Support [a-zA-Z].
2018-02-07 Richard Biener <rguenther@suse.de> 2018-02-07 Richard Biener <rguenther@suse.de>
PR tree-optimization/84037 PR tree-optimization/84037
......
...@@ -33,9 +33,10 @@ along with GCC; see the file COPYING3. If not see ...@@ -33,9 +33,10 @@ along with GCC; see the file COPYING3. If not see
The string for each operand describes that path to the operand and The string for each operand describes that path to the operand and
contains `0' through `9' when going into an expression and `a' through contains `0' through `9' when going into an expression and `a' through
`z' when going into a vector. We assume here that only the first operand `z' then 'A' through to 'Z' when going into a vector. We assume here that
of an rtl expression is a vector. genrecog.c makes the same assumption only the first operand of an rtl expression is a vector. genrecog.c makes
(and uses the same representation) and it is currently true. */ the same assumption (and uses the same representation) and it is currently
true. */
typedef char *locstr; typedef char *locstr;
...@@ -80,6 +81,23 @@ struct accum_extract ...@@ -80,6 +81,23 @@ struct accum_extract
/* Forward declarations. */ /* Forward declarations. */
static void walk_rtx (md_rtx_info *, rtx, struct accum_extract *); static void walk_rtx (md_rtx_info *, rtx, struct accum_extract *);
#define UPPER_OFFSET ('A' - ('z' - 'a' + 1))
/* Convert integer OPERAND into a character - either into [a-zA-Z] for vector
operands or [0-9] for integer operands - and push onto the end of the path
in ACC. */
static void
push_pathstr_operand (int operand, bool is_vector,
struct accum_extract *acc)
{
if (is_vector && 'a' + operand > 'z')
acc->pathstr.safe_push (operand + UPPER_OFFSET);
else if (is_vector)
acc->pathstr.safe_push (operand + 'a');
else
acc->pathstr.safe_push (operand + '0');
}
static void static void
gen_insn (md_rtx_info *info) gen_insn (md_rtx_info *info)
{ {
...@@ -98,7 +116,7 @@ gen_insn (md_rtx_info *info) ...@@ -98,7 +116,7 @@ gen_insn (md_rtx_info *info)
else else
for (i = XVECLEN (insn, 1) - 1; i >= 0; i--) for (i = XVECLEN (insn, 1) - 1; i >= 0; i--)
{ {
acc.pathstr.safe_push ('a' + i); push_pathstr_operand (i, true, &acc);
walk_rtx (info, XVECEXP (insn, 1, i), &acc); walk_rtx (info, XVECEXP (insn, 1, i), &acc);
acc.pathstr.pop (); acc.pathstr.pop ();
} }
...@@ -208,7 +226,7 @@ static void ...@@ -208,7 +226,7 @@ static void
walk_rtx (md_rtx_info *info, rtx x, struct accum_extract *acc) walk_rtx (md_rtx_info *info, rtx x, struct accum_extract *acc)
{ {
RTX_CODE code; RTX_CODE code;
int i, len, base; int i, len;
const char *fmt; const char *fmt;
if (x == 0) if (x == 0)
...@@ -234,10 +252,9 @@ walk_rtx (md_rtx_info *info, rtx x, struct accum_extract *acc) ...@@ -234,10 +252,9 @@ walk_rtx (md_rtx_info *info, rtx x, struct accum_extract *acc)
VEC_safe_set_locstr (info, &acc->oplocs, XINT (x, 0), VEC_safe_set_locstr (info, &acc->oplocs, XINT (x, 0),
VEC_char_to_string (acc->pathstr)); VEC_char_to_string (acc->pathstr));
base = (code == MATCH_OPERATOR ? '0' : 'a');
for (i = XVECLEN (x, 2) - 1; i >= 0; i--) for (i = XVECLEN (x, 2) - 1; i >= 0; i--)
{ {
acc->pathstr.safe_push (base + i); push_pathstr_operand (i, code != MATCH_OPERATOR, acc);
walk_rtx (info, XVECEXP (x, 2, i), acc); walk_rtx (info, XVECEXP (x, 2, i), acc);
acc->pathstr.pop (); acc->pathstr.pop ();
} }
...@@ -252,10 +269,9 @@ walk_rtx (md_rtx_info *info, rtx x, struct accum_extract *acc) ...@@ -252,10 +269,9 @@ walk_rtx (md_rtx_info *info, rtx x, struct accum_extract *acc)
if (code == MATCH_DUP) if (code == MATCH_DUP)
break; break;
base = (code == MATCH_OP_DUP ? '0' : 'a');
for (i = XVECLEN (x, 1) - 1; i >= 0; i--) for (i = XVECLEN (x, 1) - 1; i >= 0; i--)
{ {
acc->pathstr.safe_push (base + i); push_pathstr_operand (i, code != MATCH_OP_DUP, acc);
walk_rtx (info, XVECEXP (x, 1, i), acc); walk_rtx (info, XVECEXP (x, 1, i), acc);
acc->pathstr.pop (); acc->pathstr.pop ();
} }
...@@ -271,7 +287,7 @@ walk_rtx (md_rtx_info *info, rtx x, struct accum_extract *acc) ...@@ -271,7 +287,7 @@ walk_rtx (md_rtx_info *info, rtx x, struct accum_extract *acc)
{ {
if (fmt[i] == 'e' || fmt[i] == 'u') if (fmt[i] == 'e' || fmt[i] == 'u')
{ {
acc->pathstr.safe_push ('0' + i); push_pathstr_operand (i, false, acc);
walk_rtx (info, XEXP (x, i), acc); walk_rtx (info, XEXP (x, i), acc);
acc->pathstr.pop (); acc->pathstr.pop ();
} }
...@@ -280,7 +296,7 @@ walk_rtx (md_rtx_info *info, rtx x, struct accum_extract *acc) ...@@ -280,7 +296,7 @@ walk_rtx (md_rtx_info *info, rtx x, struct accum_extract *acc)
int j; int j;
for (j = XVECLEN (x, i) - 1; j >= 0; j--) for (j = XVECLEN (x, i) - 1; j >= 0; j--)
{ {
acc->pathstr.safe_push ('a' + j); push_pathstr_operand (j, true, acc);
walk_rtx (info, XVECEXP (x, i, j), acc); walk_rtx (info, XVECEXP (x, i, j), acc);
acc->pathstr.pop (); acc->pathstr.pop ();
} }
...@@ -311,7 +327,7 @@ print_path (const char *path) ...@@ -311,7 +327,7 @@ print_path (const char *path)
for (i = len - 1; i >= 0 ; i--) for (i = len - 1; i >= 0 ; i--)
{ {
if (ISLOWER (path[i])) if (ISLOWER (path[i]) || ISUPPER (path[i]))
fputs ("XVECEXP (", stdout); fputs ("XVECEXP (", stdout);
else if (ISDIGIT (path[i])) else if (ISDIGIT (path[i]))
fputs ("XEXP (", stdout); fputs ("XEXP (", stdout);
...@@ -323,7 +339,9 @@ print_path (const char *path) ...@@ -323,7 +339,9 @@ print_path (const char *path)
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
{ {
if (ISLOWER (path[i])) if (ISUPPER (path[i]))
printf (", 0, %d)", path[i] - UPPER_OFFSET);
else if (ISLOWER (path[i]))
printf (", 0, %d)", path[i] - 'a'); printf (", 0, %d)", path[i] - 'a');
else if (ISDIGIT (path[i])) else if (ISDIGIT (path[i]))
printf (", %d)", path[i] - '0'); printf (", %d)", path[i] - '0');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment