public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/wschmidt/heads/builtins10)] rs6000: **squash me** for 0006 (and others)
@ 2021-06-04 16:47 William Schmidt
0 siblings, 0 replies; only message in thread
From: William Schmidt @ 2021-06-04 16:47 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:e871cb7ac90c2476fecfdbfb86600294bf64ae39
commit e871cb7ac90c2476fecfdbfb86600294bf64ae39
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date: Fri Jun 4 11:47:18 2021 -0500
rs6000: **squash me** for 0006 (and others)
2021-06-04 Bill Schmidt <wschmidt@linux.ibm.com>
gcc/
* config/rs6000/rs6000-gen-builtins.c (MININT): Remove.
(typeinfo): Make val1 and val2 into strings.
(prototype): Make restr_val1 and restr_val2 into arrays of
strings.
(match_integer): Change to return a string; use NULL as a flag
instead of MININT.
(match_const_restriction): Calls to match_integer now return
strings.
(parse_args): Change type of val2 and val2; adjust debug.
(parse_prototype): Adjust debug.
(write_bif_static_init): Write restr_val1 and restr_val2 as
strings instead of integers.
Diff:
---
gcc/config/rs6000/rs6000-gen-builtins.c | 71 +++++++++++++++------------------
1 file changed, 33 insertions(+), 38 deletions(-)
diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index d377c91c96b..99ebc58fc99 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -166,10 +166,6 @@ along with GCC; see the file COPYING3. If not see
#include <unistd.h>
#include "rbtree.h"
-/* Used as a sentinel for range constraints on integer fields. No field can
- be 64 bits wide, so this is a safe sentinel value. */
-#define MININT INT_MIN
-
/* Input and output file descriptors and pathnames. */
static FILE *bif_file;
static FILE *ovld_file;
@@ -340,8 +336,8 @@ struct typeinfo {
char ispointer;
basetype base;
restriction restr;
- int val1;
- int val2;
+ char *val1;
+ char *val2;
};
/* A list of argument types. */
@@ -384,8 +380,8 @@ struct prototype {
typelist *args;
int restr_opnd[MAXRESTROPNDS];
restriction restr[MAXRESTROPNDS];
- int restr_val1[MAXRESTROPNDS];
- int restr_val2[MAXRESTROPNDS];
+ char *restr_val1[MAXRESTROPNDS];
+ char *restr_val2[MAXRESTROPNDS];
};
/* Data associated with a builtin function, and a table of such data. */
@@ -637,8 +633,9 @@ match_identifier (void)
return buf;
}
-/* Match an integer and return its value, or MININT on failure. */
-static int
+/* Match an integer and return the string representing its value,
+ or a null string on failure. */
+static char *
match_integer (void)
{
int startpos = pos;
@@ -650,16 +647,13 @@ match_integer (void)
++lastpos;
if (lastpos < pos)
- return MININT;
+ return NULL;
pos = lastpos + 1;
char *buf = (char *) malloc (lastpos - startpos + 2);
memcpy (buf, &linebuf[startpos], lastpos - startpos + 1);
buf[lastpos - startpos + 1] = '\0';
-
- int x;
- sscanf (buf, "%d", &x);
- return x;
+ return buf;
}
/* Match a string up to but not including a ']', and return its value,
@@ -806,8 +800,8 @@ match_const_restriction (typeinfo *typedata)
{
safe_inc_pos ();
oldpos = pos;
- int x = match_integer ();
- if (x == MININT)
+ char *x = match_integer ();
+ if (x == NULL)
{
(*diag) ("malformed integer at column %d.\n", oldpos + 1);
return 0;
@@ -827,8 +821,8 @@ match_const_restriction (typeinfo *typedata)
}
safe_inc_pos ();
oldpos = pos;
- int y = match_integer ();
- if (y == MININT)
+ char *y = match_integer ();
+ if (y == NULL)
{
(*diag) ("malformed integer at column %d.\n", oldpos + 1);
return 0;
@@ -849,8 +843,8 @@ match_const_restriction (typeinfo *typedata)
{
safe_inc_pos ();
oldpos = pos;
- int x = match_integer ();
- if (x == MININT)
+ char *x = match_integer ();
+ if (x == NULL)
{
(*diag) ("malformed integer at column %d.\n", oldpos + 1);
return 0;
@@ -864,8 +858,8 @@ match_const_restriction (typeinfo *typedata)
safe_inc_pos ();
consume_whitespace ();
oldpos = pos;
- int y = match_integer ();
- if (y == MININT)
+ char *y = match_integer ();
+ if (y == NULL)
{
(*diag) ("malformed integer at column %d.\n", oldpos + 1);
return 0;
@@ -887,8 +881,8 @@ match_const_restriction (typeinfo *typedata)
assert (linebuf[pos] == '[');
safe_inc_pos ();
oldpos = pos;
- int x = match_integer ();
- if (x == MININT)
+ char *x = match_integer ();
+ if (x == NULL)
{
(*diag) ("malformed integer at column %d.\n", oldpos + 1);
return 0;
@@ -902,8 +896,8 @@ match_const_restriction (typeinfo *typedata)
safe_inc_pos ();
consume_whitespace ();
oldpos = pos;
- int y = match_integer ();
- if (y == MININT)
+ char *y = match_integer ();
+ if (y == NULL)
{
(*diag) ("malformed integer at column %d.\n", oldpos + 1);
return 0;
@@ -1212,8 +1206,8 @@ parse_args (prototype *protoptr)
int *nargs = &protoptr->nargs;
int *restr_opnd = protoptr->restr_opnd;
restriction *restr = protoptr->restr;
- int *val1 = protoptr->restr_val1;
- int *val2 = protoptr->restr_val2;
+ char **val1 = protoptr->restr_val1;
+ char **val2 = protoptr->restr_val2;
int restr_cnt = 0;
int success;
@@ -1265,7 +1259,7 @@ parse_args (prototype *protoptr)
#ifdef DEBUG
(*diag) ("argument type: isvoid = %d, isconst = %d, isvector = %d, \
issigned = %d, isunsigned = %d, isbool = %d, ispixel = %d, ispointer = %d, \
-base = %d, restr = %d, val1 = %d, val2 = %d, pos = %d.\n",
+base = %d, restr = %d, val1 = \"%s\", val2 = \"%s\", pos = %d.\n",
argtype->isvoid, argtype->isconst, argtype->isvector,
argtype->issigned, argtype->isunsigned, argtype->isbool,
argtype->ispixel, argtype->ispointer, argtype->base,
@@ -1645,8 +1639,7 @@ parse_prototype (prototype *protoptr)
#ifdef DEBUG
(*diag) ("return type: isvoid = %d, isconst = %d, isvector = %d, \
issigned = %d, isunsigned = %d, isbool = %d, ispixel = %d, ispointer = %d, \
-base = %d, restr[0] = %d, val1[0] = %d, val2[0] = %d, restr1[1] = %d, \
-val1[1] = %d, val2[1] = %d, pos = %d.\n",
+base = %d, restr = %d, val1 = \"%s\", val2 = \"%s\", pos = %d.\n",
ret_type->isvoid, ret_type->isconst, ret_type->isvector,
ret_type->issigned, ret_type->isunsigned, ret_type->isbool,
ret_type->ispixel, ret_type->ispointer, ret_type->base,
@@ -2515,12 +2508,14 @@ write_bif_static_init (void)
? "RES_VAR_RANGE" : "ERROR")))));
fprintf (init_file, " /* restr */\t{%s, %s, %s},\n",
res[0], res[1], res[2]);
- fprintf (init_file, " /* restr_val1 */\t{%d, %d, %d},\n",
- bifp->proto.restr_val1[0], bifp->proto.restr_val1[1],
- bifp->proto.restr_val1[2]);
- fprintf (init_file, " /* restr_val2 */\t{%d, %d, %d},\n",
- bifp->proto.restr_val2[0], bifp->proto.restr_val2[1],
- bifp->proto.restr_val2[2]);
+ fprintf (init_file, " /* restr_val1 */\t{%s, %s, %s},\n",
+ bifp->proto.restr_val1[0] ? bifp->proto.restr_val1[0] : "0",
+ bifp->proto.restr_val1[1] ? bifp->proto.restr_val1[1] : "0",
+ bifp->proto.restr_val1[2] ? bifp->proto.restr_val1[2] : "0");
+ fprintf (init_file, " /* restr_val2 */\t{%s, %s, %s},\n",
+ bifp->proto.restr_val2[0] ? bifp->proto.restr_val2[0] : "0",
+ bifp->proto.restr_val2[1] ? bifp->proto.restr_val2[1] : "0",
+ bifp->proto.restr_val2[2] ? bifp->proto.restr_val2[2] : "0");
fprintf (init_file, " /* attr_string */\t\"%s\",\n",
(bifp->kind == FNK_CONST ? "= const"
: (bifp->kind == FNK_PURE ? "= pure"
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-06-04 16:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-04 16:47 [gcc(refs/users/wschmidt/heads/builtins10)] rs6000: **squash me** for 0006 (and others) William Schmidt
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).