public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/wschmidt/heads/builtins3)] rs6000: Add functions for matching types, part 1 of 3
@ 2020-09-14 13:57 William Schmidt
0 siblings, 0 replies; 10+ messages in thread
From: William Schmidt @ 2020-09-14 13:57 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:a0919f9cb205a2a1f237f9a35ea582c3aac834d0
commit a0919f9cb205a2a1f237f9a35ea582c3aac834d0
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date: Wed Jun 17 10:01:32 2020 -0500
rs6000: Add functions for matching types, part 1 of 3
2020-07-26 Bill Schmidt <wschmidt@linux.ibm.com>
* config/rs6000/rs6000-gen-builtins.c (void_status): New enum.
(basetype): Likewise.
(typeinfo): New struct.
(handle_pointer): New function.
(match_basetype): New stub function.
(match_const_restriction): Likewise.
(match_type): New function.
Diff:
---
gcc/config/rs6000/rs6000-gen-builtins.c | 382 ++++++++++++++++++++++++++++++++
1 file changed, 382 insertions(+)
diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index e2a9b28eb16..ea1ebedfa52 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -166,6 +166,44 @@ static char linebuf[LINELEN];
static int line;
static int pos;
+/* Used to determine whether a type can be void (only return types). */
+enum void_status {
+ VOID_NOTOK,
+ VOID_OK
+};
+
+/* Legal base types for an argument or return type. */
+enum basetype {
+ BT_CHAR,
+ BT_SHORT,
+ BT_INT,
+ BT_LONGLONG,
+ BT_FLOAT,
+ BT_DOUBLE,
+ BT_INT128,
+ BT_FLOAT128,
+ BT_DECIMAL32,
+ BT_DECIMAL64,
+ BT_DECIMAL128,
+ BT_IBM128
+};
+
+/* Type modifiers for an argument or return type. */
+struct typeinfo {
+ char isvoid;
+ char isconst;
+ char isvector;
+ char issigned;
+ char isunsigned;
+ char isbool;
+ char ispixel;
+ char ispointer;
+ char isopaque;
+ basetype base;
+ int val1;
+ int val2;
+};
+
/* Exit codes for the shell. */
enum exit_codes {
EC_INTERR
@@ -308,3 +346,347 @@ match_to_right_bracket ()
return buf;
}
+static inline void
+handle_pointer (typeinfo *typedata)
+{
+ consume_whitespace ();
+ if (linebuf[pos] == '*')
+ {
+ typedata->ispointer = 1;
+ safe_inc_pos ();
+ }
+}
+
+/* Match one of the allowable base types. Consumes one token unless the
+ token is "long", which must be paired with a second "long". Optionally
+ consumes a following '*' token for pointers. Return 1 for success,
+ 0 for failure. */
+static int
+match_basetype (typeinfo *typedata)
+{
+ return 1;
+}
+
+/* A const int argument may be restricted to certain values. This is
+ indicated by one of the following occurring after the "int' token:
+
+ <x> restricts the constant to x bits, interpreted as unsigned
+ <x,y> restricts the constant to the inclusive range [x,y]
+ [x,y] restricts the constant to the inclusive range [x,y],
+ but only applies if the argument is constant.
+ {x,y} restricts the constant to one of two values, x or y.
+
+ Here x and y are integer tokens. Note that the "const" token is a
+ lie when the restriction is [x,y], but this simplifies the parsing
+ significantly and is hopefully forgivable.
+
+ Return 1 for success, else 0. */
+static int
+match_const_restriction (typeinfo *typedata)
+{
+ return 1;
+}
+
+/* Look for a type, which can be terminated by a token that is not part of
+ a type, a comma, or a closing parenthesis. Place information about the
+ type in TYPEDATA. Return 1 for success, 0 for failure. */
+static int
+match_type (typeinfo *typedata, int voidok)
+{
+ /* A legal type is of the form:
+
+ [const] [[signed|unsigned] <basetype> | <vectype>] [*]
+
+ where "const" applies only to a <basetype> of "int". Legal values
+ of <basetype> are (for now):
+
+ char
+ short
+ int
+ long long
+ float
+ double
+ __int128
+ _Float128
+ _Decimal32
+ _Decimal64
+ _Decimal128
+ __ibm128
+
+ Legal values of <vectype> are as follows, and are shorthand for
+ the associated meaning:
+
+ vsc vector signed char
+ vuc vector unsigned char
+ vbc vector bool char
+ vss vector signed short
+ vus vector unsigned short
+ vbs vector bool short
+ vsi vector signed int
+ vui vector unsigned int
+ vbi vector bool int
+ vsll vector signed long long
+ vull vector unsigned long long
+ vbll vector bool long long
+ vsq vector signed __int128
+ vuq vector unsigned __int128
+ vbq vector bool __int128
+ vp vector pixel
+ vf vector float
+ vd vector double
+ vop opaque vector (matches all vectors)
+
+ For simplicity, We don't support "short int" and "long long int".
+ We don't support a <basetype> of "bool", "long double", or "_Float16",
+ but will add these if builtins require it. "signed" and "unsigned"
+ only apply to integral base types. The optional * indicates a pointer
+ type, which can be used with any base type, but is treated for type
+ signature purposes as a pointer to void. */
+
+ consume_whitespace ();
+ memset (typedata, 0, sizeof(*typedata));
+ int oldpos = pos;
+
+ char *token = match_identifier ();
+ if (!token)
+ return 0;
+
+ if (!strcmp (token, "void"))
+ typedata->isvoid = 1;
+
+ if (!strcmp (token, "const"))
+ {
+ typedata->isconst = 1;
+ consume_whitespace ();
+ oldpos = pos;
+ token = match_identifier ();
+ }
+
+ if (!strcmp (token, "vsc"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vuc"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbc"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vss"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vus"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbs"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vsi"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_INT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vui"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_INT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbi"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_INT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vsll"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_LONGLONG;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vull"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_LONGLONG;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbll"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_LONGLONG;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vsq"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_INT128;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vuq"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_INT128;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbq"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_INT128;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vp"))
+ {
+ typedata->isvector = 1;
+ typedata->ispixel = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vf"))
+ {
+ typedata->isvector = 1;
+ typedata->base = BT_FLOAT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vd"))
+ {
+ typedata->isvector = 1;
+ typedata->base = BT_DOUBLE;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vop"))
+ {
+ typedata->isopaque = 1;
+ return 1;
+ }
+ else if (!strcmp (token, "signed"))
+ typedata->issigned = 1;
+ else if (!strcmp (token, "unsigned"))
+ typedata->isunsigned = 1;
+ else if (!typedata->isvoid && !typedata->isconst)
+ {
+ /* Push back token. */
+ pos = oldpos;
+ return match_basetype (typedata);
+ }
+
+ if (typedata->isvoid)
+ {
+ consume_whitespace ();
+ if (linebuf[pos] == '*')
+ {
+ typedata->ispointer = 1;
+ safe_inc_pos ();
+ }
+ else if (!voidok)
+ return 0;
+ return 1;
+ }
+
+ if (typedata->isconst)
+ {
+ consume_whitespace ();
+ pos = oldpos;
+ token = match_identifier ();
+ if (!strcmp (token, "char"))
+ {
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "signed"))
+ {
+ typedata->issigned = 1;
+ consume_whitespace ();
+ oldpos = pos;
+ token = match_identifier ();
+ if (strcmp (token, "int"))
+ {
+ (*diag) ("'signed' not followed by 'int' at column %d.\n",
+ oldpos + 1);
+ return 0;
+ }
+ }
+ else if (!strcmp (token, "unsigned"))
+ {
+ typedata->isunsigned = 1;
+ consume_whitespace ();
+ oldpos = pos;
+ token = match_identifier ();
+ if (strcmp (token, "int"))
+ {
+ (*diag) ("'unsigned' not followed by 'int' at column %d.\n",
+ oldpos + 1);
+ return 0;
+ }
+ }
+ else if (strcmp (token, "int"))
+ {
+ (*diag) ("'const' not followed by 'int' at column %d.\n",
+ oldpos + 1);
+ return 0;
+ }
+
+ typedata->base = BT_INT;
+
+ consume_whitespace ();
+ if (linebuf[pos] == '<' || linebuf[pos] == '{' || linebuf[pos] == '[')
+ return match_const_restriction (typedata);
+
+ return 1;
+ }
+
+ consume_whitespace ();
+ return match_basetype (typedata);
+}
+
^ permalink raw reply [flat|nested] 10+ messages in thread
* [gcc(refs/users/wschmidt/heads/builtins3)] rs6000: Add functions for matching types, part 1 of 3
@ 2020-10-29 19:49 William Schmidt
0 siblings, 0 replies; 10+ messages in thread
From: William Schmidt @ 2020-10-29 19:49 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:990707d666164698ec36588420756487a6af816e
commit 990707d666164698ec36588420756487a6af816e
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date: Wed Jun 17 10:01:32 2020 -0500
rs6000: Add functions for matching types, part 1 of 3
2020-07-26 Bill Schmidt <wschmidt@linux.ibm.com>
* config/rs6000/rs6000-gen-builtins.c (void_status): New enum.
(basetype): Likewise.
(typeinfo): New struct.
(handle_pointer): New function.
(match_basetype): New stub function.
(match_const_restriction): Likewise.
(match_type): New function.
Diff:
---
gcc/config/rs6000/rs6000-gen-builtins.c | 382 ++++++++++++++++++++++++++++++++
1 file changed, 382 insertions(+)
diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index e2a9b28eb16..ea1ebedfa52 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -166,6 +166,44 @@ static char linebuf[LINELEN];
static int line;
static int pos;
+/* Used to determine whether a type can be void (only return types). */
+enum void_status {
+ VOID_NOTOK,
+ VOID_OK
+};
+
+/* Legal base types for an argument or return type. */
+enum basetype {
+ BT_CHAR,
+ BT_SHORT,
+ BT_INT,
+ BT_LONGLONG,
+ BT_FLOAT,
+ BT_DOUBLE,
+ BT_INT128,
+ BT_FLOAT128,
+ BT_DECIMAL32,
+ BT_DECIMAL64,
+ BT_DECIMAL128,
+ BT_IBM128
+};
+
+/* Type modifiers for an argument or return type. */
+struct typeinfo {
+ char isvoid;
+ char isconst;
+ char isvector;
+ char issigned;
+ char isunsigned;
+ char isbool;
+ char ispixel;
+ char ispointer;
+ char isopaque;
+ basetype base;
+ int val1;
+ int val2;
+};
+
/* Exit codes for the shell. */
enum exit_codes {
EC_INTERR
@@ -308,3 +346,347 @@ match_to_right_bracket ()
return buf;
}
+static inline void
+handle_pointer (typeinfo *typedata)
+{
+ consume_whitespace ();
+ if (linebuf[pos] == '*')
+ {
+ typedata->ispointer = 1;
+ safe_inc_pos ();
+ }
+}
+
+/* Match one of the allowable base types. Consumes one token unless the
+ token is "long", which must be paired with a second "long". Optionally
+ consumes a following '*' token for pointers. Return 1 for success,
+ 0 for failure. */
+static int
+match_basetype (typeinfo *typedata)
+{
+ return 1;
+}
+
+/* A const int argument may be restricted to certain values. This is
+ indicated by one of the following occurring after the "int' token:
+
+ <x> restricts the constant to x bits, interpreted as unsigned
+ <x,y> restricts the constant to the inclusive range [x,y]
+ [x,y] restricts the constant to the inclusive range [x,y],
+ but only applies if the argument is constant.
+ {x,y} restricts the constant to one of two values, x or y.
+
+ Here x and y are integer tokens. Note that the "const" token is a
+ lie when the restriction is [x,y], but this simplifies the parsing
+ significantly and is hopefully forgivable.
+
+ Return 1 for success, else 0. */
+static int
+match_const_restriction (typeinfo *typedata)
+{
+ return 1;
+}
+
+/* Look for a type, which can be terminated by a token that is not part of
+ a type, a comma, or a closing parenthesis. Place information about the
+ type in TYPEDATA. Return 1 for success, 0 for failure. */
+static int
+match_type (typeinfo *typedata, int voidok)
+{
+ /* A legal type is of the form:
+
+ [const] [[signed|unsigned] <basetype> | <vectype>] [*]
+
+ where "const" applies only to a <basetype> of "int". Legal values
+ of <basetype> are (for now):
+
+ char
+ short
+ int
+ long long
+ float
+ double
+ __int128
+ _Float128
+ _Decimal32
+ _Decimal64
+ _Decimal128
+ __ibm128
+
+ Legal values of <vectype> are as follows, and are shorthand for
+ the associated meaning:
+
+ vsc vector signed char
+ vuc vector unsigned char
+ vbc vector bool char
+ vss vector signed short
+ vus vector unsigned short
+ vbs vector bool short
+ vsi vector signed int
+ vui vector unsigned int
+ vbi vector bool int
+ vsll vector signed long long
+ vull vector unsigned long long
+ vbll vector bool long long
+ vsq vector signed __int128
+ vuq vector unsigned __int128
+ vbq vector bool __int128
+ vp vector pixel
+ vf vector float
+ vd vector double
+ vop opaque vector (matches all vectors)
+
+ For simplicity, We don't support "short int" and "long long int".
+ We don't support a <basetype> of "bool", "long double", or "_Float16",
+ but will add these if builtins require it. "signed" and "unsigned"
+ only apply to integral base types. The optional * indicates a pointer
+ type, which can be used with any base type, but is treated for type
+ signature purposes as a pointer to void. */
+
+ consume_whitespace ();
+ memset (typedata, 0, sizeof(*typedata));
+ int oldpos = pos;
+
+ char *token = match_identifier ();
+ if (!token)
+ return 0;
+
+ if (!strcmp (token, "void"))
+ typedata->isvoid = 1;
+
+ if (!strcmp (token, "const"))
+ {
+ typedata->isconst = 1;
+ consume_whitespace ();
+ oldpos = pos;
+ token = match_identifier ();
+ }
+
+ if (!strcmp (token, "vsc"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vuc"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbc"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vss"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vus"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbs"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vsi"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_INT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vui"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_INT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbi"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_INT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vsll"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_LONGLONG;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vull"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_LONGLONG;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbll"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_LONGLONG;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vsq"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_INT128;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vuq"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_INT128;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbq"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_INT128;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vp"))
+ {
+ typedata->isvector = 1;
+ typedata->ispixel = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vf"))
+ {
+ typedata->isvector = 1;
+ typedata->base = BT_FLOAT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vd"))
+ {
+ typedata->isvector = 1;
+ typedata->base = BT_DOUBLE;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vop"))
+ {
+ typedata->isopaque = 1;
+ return 1;
+ }
+ else if (!strcmp (token, "signed"))
+ typedata->issigned = 1;
+ else if (!strcmp (token, "unsigned"))
+ typedata->isunsigned = 1;
+ else if (!typedata->isvoid && !typedata->isconst)
+ {
+ /* Push back token. */
+ pos = oldpos;
+ return match_basetype (typedata);
+ }
+
+ if (typedata->isvoid)
+ {
+ consume_whitespace ();
+ if (linebuf[pos] == '*')
+ {
+ typedata->ispointer = 1;
+ safe_inc_pos ();
+ }
+ else if (!voidok)
+ return 0;
+ return 1;
+ }
+
+ if (typedata->isconst)
+ {
+ consume_whitespace ();
+ pos = oldpos;
+ token = match_identifier ();
+ if (!strcmp (token, "char"))
+ {
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "signed"))
+ {
+ typedata->issigned = 1;
+ consume_whitespace ();
+ oldpos = pos;
+ token = match_identifier ();
+ if (strcmp (token, "int"))
+ {
+ (*diag) ("'signed' not followed by 'int' at column %d.\n",
+ oldpos + 1);
+ return 0;
+ }
+ }
+ else if (!strcmp (token, "unsigned"))
+ {
+ typedata->isunsigned = 1;
+ consume_whitespace ();
+ oldpos = pos;
+ token = match_identifier ();
+ if (strcmp (token, "int"))
+ {
+ (*diag) ("'unsigned' not followed by 'int' at column %d.\n",
+ oldpos + 1);
+ return 0;
+ }
+ }
+ else if (strcmp (token, "int"))
+ {
+ (*diag) ("'const' not followed by 'int' at column %d.\n",
+ oldpos + 1);
+ return 0;
+ }
+
+ typedata->base = BT_INT;
+
+ consume_whitespace ();
+ if (linebuf[pos] == '<' || linebuf[pos] == '{' || linebuf[pos] == '[')
+ return match_const_restriction (typedata);
+
+ return 1;
+ }
+
+ consume_whitespace ();
+ return match_basetype (typedata);
+}
+
^ permalink raw reply [flat|nested] 10+ messages in thread
* [gcc(refs/users/wschmidt/heads/builtins3)] rs6000: Add functions for matching types, part 1 of 3
@ 2020-10-27 16:27 William Schmidt
0 siblings, 0 replies; 10+ messages in thread
From: William Schmidt @ 2020-10-27 16:27 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:4432519cc67845d52237be654c217ba4aaf4fa0c
commit 4432519cc67845d52237be654c217ba4aaf4fa0c
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date: Wed Jun 17 10:01:32 2020 -0500
rs6000: Add functions for matching types, part 1 of 3
2020-07-26 Bill Schmidt <wschmidt@linux.ibm.com>
* config/rs6000/rs6000-gen-builtins.c (void_status): New enum.
(basetype): Likewise.
(typeinfo): New struct.
(handle_pointer): New function.
(match_basetype): New stub function.
(match_const_restriction): Likewise.
(match_type): New function.
Diff:
---
gcc/config/rs6000/rs6000-gen-builtins.c | 382 ++++++++++++++++++++++++++++++++
1 file changed, 382 insertions(+)
diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index e2a9b28eb16..ea1ebedfa52 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -166,6 +166,44 @@ static char linebuf[LINELEN];
static int line;
static int pos;
+/* Used to determine whether a type can be void (only return types). */
+enum void_status {
+ VOID_NOTOK,
+ VOID_OK
+};
+
+/* Legal base types for an argument or return type. */
+enum basetype {
+ BT_CHAR,
+ BT_SHORT,
+ BT_INT,
+ BT_LONGLONG,
+ BT_FLOAT,
+ BT_DOUBLE,
+ BT_INT128,
+ BT_FLOAT128,
+ BT_DECIMAL32,
+ BT_DECIMAL64,
+ BT_DECIMAL128,
+ BT_IBM128
+};
+
+/* Type modifiers for an argument or return type. */
+struct typeinfo {
+ char isvoid;
+ char isconst;
+ char isvector;
+ char issigned;
+ char isunsigned;
+ char isbool;
+ char ispixel;
+ char ispointer;
+ char isopaque;
+ basetype base;
+ int val1;
+ int val2;
+};
+
/* Exit codes for the shell. */
enum exit_codes {
EC_INTERR
@@ -308,3 +346,347 @@ match_to_right_bracket ()
return buf;
}
+static inline void
+handle_pointer (typeinfo *typedata)
+{
+ consume_whitespace ();
+ if (linebuf[pos] == '*')
+ {
+ typedata->ispointer = 1;
+ safe_inc_pos ();
+ }
+}
+
+/* Match one of the allowable base types. Consumes one token unless the
+ token is "long", which must be paired with a second "long". Optionally
+ consumes a following '*' token for pointers. Return 1 for success,
+ 0 for failure. */
+static int
+match_basetype (typeinfo *typedata)
+{
+ return 1;
+}
+
+/* A const int argument may be restricted to certain values. This is
+ indicated by one of the following occurring after the "int' token:
+
+ <x> restricts the constant to x bits, interpreted as unsigned
+ <x,y> restricts the constant to the inclusive range [x,y]
+ [x,y] restricts the constant to the inclusive range [x,y],
+ but only applies if the argument is constant.
+ {x,y} restricts the constant to one of two values, x or y.
+
+ Here x and y are integer tokens. Note that the "const" token is a
+ lie when the restriction is [x,y], but this simplifies the parsing
+ significantly and is hopefully forgivable.
+
+ Return 1 for success, else 0. */
+static int
+match_const_restriction (typeinfo *typedata)
+{
+ return 1;
+}
+
+/* Look for a type, which can be terminated by a token that is not part of
+ a type, a comma, or a closing parenthesis. Place information about the
+ type in TYPEDATA. Return 1 for success, 0 for failure. */
+static int
+match_type (typeinfo *typedata, int voidok)
+{
+ /* A legal type is of the form:
+
+ [const] [[signed|unsigned] <basetype> | <vectype>] [*]
+
+ where "const" applies only to a <basetype> of "int". Legal values
+ of <basetype> are (for now):
+
+ char
+ short
+ int
+ long long
+ float
+ double
+ __int128
+ _Float128
+ _Decimal32
+ _Decimal64
+ _Decimal128
+ __ibm128
+
+ Legal values of <vectype> are as follows, and are shorthand for
+ the associated meaning:
+
+ vsc vector signed char
+ vuc vector unsigned char
+ vbc vector bool char
+ vss vector signed short
+ vus vector unsigned short
+ vbs vector bool short
+ vsi vector signed int
+ vui vector unsigned int
+ vbi vector bool int
+ vsll vector signed long long
+ vull vector unsigned long long
+ vbll vector bool long long
+ vsq vector signed __int128
+ vuq vector unsigned __int128
+ vbq vector bool __int128
+ vp vector pixel
+ vf vector float
+ vd vector double
+ vop opaque vector (matches all vectors)
+
+ For simplicity, We don't support "short int" and "long long int".
+ We don't support a <basetype> of "bool", "long double", or "_Float16",
+ but will add these if builtins require it. "signed" and "unsigned"
+ only apply to integral base types. The optional * indicates a pointer
+ type, which can be used with any base type, but is treated for type
+ signature purposes as a pointer to void. */
+
+ consume_whitespace ();
+ memset (typedata, 0, sizeof(*typedata));
+ int oldpos = pos;
+
+ char *token = match_identifier ();
+ if (!token)
+ return 0;
+
+ if (!strcmp (token, "void"))
+ typedata->isvoid = 1;
+
+ if (!strcmp (token, "const"))
+ {
+ typedata->isconst = 1;
+ consume_whitespace ();
+ oldpos = pos;
+ token = match_identifier ();
+ }
+
+ if (!strcmp (token, "vsc"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vuc"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbc"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vss"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vus"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbs"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vsi"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_INT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vui"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_INT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbi"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_INT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vsll"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_LONGLONG;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vull"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_LONGLONG;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbll"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_LONGLONG;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vsq"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_INT128;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vuq"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_INT128;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbq"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_INT128;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vp"))
+ {
+ typedata->isvector = 1;
+ typedata->ispixel = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vf"))
+ {
+ typedata->isvector = 1;
+ typedata->base = BT_FLOAT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vd"))
+ {
+ typedata->isvector = 1;
+ typedata->base = BT_DOUBLE;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vop"))
+ {
+ typedata->isopaque = 1;
+ return 1;
+ }
+ else if (!strcmp (token, "signed"))
+ typedata->issigned = 1;
+ else if (!strcmp (token, "unsigned"))
+ typedata->isunsigned = 1;
+ else if (!typedata->isvoid && !typedata->isconst)
+ {
+ /* Push back token. */
+ pos = oldpos;
+ return match_basetype (typedata);
+ }
+
+ if (typedata->isvoid)
+ {
+ consume_whitespace ();
+ if (linebuf[pos] == '*')
+ {
+ typedata->ispointer = 1;
+ safe_inc_pos ();
+ }
+ else if (!voidok)
+ return 0;
+ return 1;
+ }
+
+ if (typedata->isconst)
+ {
+ consume_whitespace ();
+ pos = oldpos;
+ token = match_identifier ();
+ if (!strcmp (token, "char"))
+ {
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "signed"))
+ {
+ typedata->issigned = 1;
+ consume_whitespace ();
+ oldpos = pos;
+ token = match_identifier ();
+ if (strcmp (token, "int"))
+ {
+ (*diag) ("'signed' not followed by 'int' at column %d.\n",
+ oldpos + 1);
+ return 0;
+ }
+ }
+ else if (!strcmp (token, "unsigned"))
+ {
+ typedata->isunsigned = 1;
+ consume_whitespace ();
+ oldpos = pos;
+ token = match_identifier ();
+ if (strcmp (token, "int"))
+ {
+ (*diag) ("'unsigned' not followed by 'int' at column %d.\n",
+ oldpos + 1);
+ return 0;
+ }
+ }
+ else if (strcmp (token, "int"))
+ {
+ (*diag) ("'const' not followed by 'int' at column %d.\n",
+ oldpos + 1);
+ return 0;
+ }
+
+ typedata->base = BT_INT;
+
+ consume_whitespace ();
+ if (linebuf[pos] == '<' || linebuf[pos] == '{' || linebuf[pos] == '[')
+ return match_const_restriction (typedata);
+
+ return 1;
+ }
+
+ consume_whitespace ();
+ return match_basetype (typedata);
+}
+
^ permalink raw reply [flat|nested] 10+ messages in thread
* [gcc(refs/users/wschmidt/heads/builtins3)] rs6000: Add functions for matching types, part 1 of 3
@ 2020-09-16 21:28 William Schmidt
0 siblings, 0 replies; 10+ messages in thread
From: William Schmidt @ 2020-09-16 21:28 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:48cb82ae98678ec5d802ff9d91a8f578d76d9625
commit 48cb82ae98678ec5d802ff9d91a8f578d76d9625
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date: Wed Jun 17 10:01:32 2020 -0500
rs6000: Add functions for matching types, part 1 of 3
2020-07-26 Bill Schmidt <wschmidt@linux.ibm.com>
* config/rs6000/rs6000-gen-builtins.c (void_status): New enum.
(basetype): Likewise.
(typeinfo): New struct.
(handle_pointer): New function.
(match_basetype): New stub function.
(match_const_restriction): Likewise.
(match_type): New function.
Diff:
---
gcc/config/rs6000/rs6000-gen-builtins.c | 382 ++++++++++++++++++++++++++++++++
1 file changed, 382 insertions(+)
diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index e2a9b28eb16..ea1ebedfa52 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -166,6 +166,44 @@ static char linebuf[LINELEN];
static int line;
static int pos;
+/* Used to determine whether a type can be void (only return types). */
+enum void_status {
+ VOID_NOTOK,
+ VOID_OK
+};
+
+/* Legal base types for an argument or return type. */
+enum basetype {
+ BT_CHAR,
+ BT_SHORT,
+ BT_INT,
+ BT_LONGLONG,
+ BT_FLOAT,
+ BT_DOUBLE,
+ BT_INT128,
+ BT_FLOAT128,
+ BT_DECIMAL32,
+ BT_DECIMAL64,
+ BT_DECIMAL128,
+ BT_IBM128
+};
+
+/* Type modifiers for an argument or return type. */
+struct typeinfo {
+ char isvoid;
+ char isconst;
+ char isvector;
+ char issigned;
+ char isunsigned;
+ char isbool;
+ char ispixel;
+ char ispointer;
+ char isopaque;
+ basetype base;
+ int val1;
+ int val2;
+};
+
/* Exit codes for the shell. */
enum exit_codes {
EC_INTERR
@@ -308,3 +346,347 @@ match_to_right_bracket ()
return buf;
}
+static inline void
+handle_pointer (typeinfo *typedata)
+{
+ consume_whitespace ();
+ if (linebuf[pos] == '*')
+ {
+ typedata->ispointer = 1;
+ safe_inc_pos ();
+ }
+}
+
+/* Match one of the allowable base types. Consumes one token unless the
+ token is "long", which must be paired with a second "long". Optionally
+ consumes a following '*' token for pointers. Return 1 for success,
+ 0 for failure. */
+static int
+match_basetype (typeinfo *typedata)
+{
+ return 1;
+}
+
+/* A const int argument may be restricted to certain values. This is
+ indicated by one of the following occurring after the "int' token:
+
+ <x> restricts the constant to x bits, interpreted as unsigned
+ <x,y> restricts the constant to the inclusive range [x,y]
+ [x,y] restricts the constant to the inclusive range [x,y],
+ but only applies if the argument is constant.
+ {x,y} restricts the constant to one of two values, x or y.
+
+ Here x and y are integer tokens. Note that the "const" token is a
+ lie when the restriction is [x,y], but this simplifies the parsing
+ significantly and is hopefully forgivable.
+
+ Return 1 for success, else 0. */
+static int
+match_const_restriction (typeinfo *typedata)
+{
+ return 1;
+}
+
+/* Look for a type, which can be terminated by a token that is not part of
+ a type, a comma, or a closing parenthesis. Place information about the
+ type in TYPEDATA. Return 1 for success, 0 for failure. */
+static int
+match_type (typeinfo *typedata, int voidok)
+{
+ /* A legal type is of the form:
+
+ [const] [[signed|unsigned] <basetype> | <vectype>] [*]
+
+ where "const" applies only to a <basetype> of "int". Legal values
+ of <basetype> are (for now):
+
+ char
+ short
+ int
+ long long
+ float
+ double
+ __int128
+ _Float128
+ _Decimal32
+ _Decimal64
+ _Decimal128
+ __ibm128
+
+ Legal values of <vectype> are as follows, and are shorthand for
+ the associated meaning:
+
+ vsc vector signed char
+ vuc vector unsigned char
+ vbc vector bool char
+ vss vector signed short
+ vus vector unsigned short
+ vbs vector bool short
+ vsi vector signed int
+ vui vector unsigned int
+ vbi vector bool int
+ vsll vector signed long long
+ vull vector unsigned long long
+ vbll vector bool long long
+ vsq vector signed __int128
+ vuq vector unsigned __int128
+ vbq vector bool __int128
+ vp vector pixel
+ vf vector float
+ vd vector double
+ vop opaque vector (matches all vectors)
+
+ For simplicity, We don't support "short int" and "long long int".
+ We don't support a <basetype> of "bool", "long double", or "_Float16",
+ but will add these if builtins require it. "signed" and "unsigned"
+ only apply to integral base types. The optional * indicates a pointer
+ type, which can be used with any base type, but is treated for type
+ signature purposes as a pointer to void. */
+
+ consume_whitespace ();
+ memset (typedata, 0, sizeof(*typedata));
+ int oldpos = pos;
+
+ char *token = match_identifier ();
+ if (!token)
+ return 0;
+
+ if (!strcmp (token, "void"))
+ typedata->isvoid = 1;
+
+ if (!strcmp (token, "const"))
+ {
+ typedata->isconst = 1;
+ consume_whitespace ();
+ oldpos = pos;
+ token = match_identifier ();
+ }
+
+ if (!strcmp (token, "vsc"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vuc"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbc"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vss"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vus"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbs"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vsi"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_INT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vui"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_INT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbi"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_INT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vsll"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_LONGLONG;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vull"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_LONGLONG;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbll"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_LONGLONG;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vsq"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_INT128;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vuq"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_INT128;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbq"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_INT128;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vp"))
+ {
+ typedata->isvector = 1;
+ typedata->ispixel = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vf"))
+ {
+ typedata->isvector = 1;
+ typedata->base = BT_FLOAT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vd"))
+ {
+ typedata->isvector = 1;
+ typedata->base = BT_DOUBLE;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vop"))
+ {
+ typedata->isopaque = 1;
+ return 1;
+ }
+ else if (!strcmp (token, "signed"))
+ typedata->issigned = 1;
+ else if (!strcmp (token, "unsigned"))
+ typedata->isunsigned = 1;
+ else if (!typedata->isvoid && !typedata->isconst)
+ {
+ /* Push back token. */
+ pos = oldpos;
+ return match_basetype (typedata);
+ }
+
+ if (typedata->isvoid)
+ {
+ consume_whitespace ();
+ if (linebuf[pos] == '*')
+ {
+ typedata->ispointer = 1;
+ safe_inc_pos ();
+ }
+ else if (!voidok)
+ return 0;
+ return 1;
+ }
+
+ if (typedata->isconst)
+ {
+ consume_whitespace ();
+ pos = oldpos;
+ token = match_identifier ();
+ if (!strcmp (token, "char"))
+ {
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "signed"))
+ {
+ typedata->issigned = 1;
+ consume_whitespace ();
+ oldpos = pos;
+ token = match_identifier ();
+ if (strcmp (token, "int"))
+ {
+ (*diag) ("'signed' not followed by 'int' at column %d.\n",
+ oldpos + 1);
+ return 0;
+ }
+ }
+ else if (!strcmp (token, "unsigned"))
+ {
+ typedata->isunsigned = 1;
+ consume_whitespace ();
+ oldpos = pos;
+ token = match_identifier ();
+ if (strcmp (token, "int"))
+ {
+ (*diag) ("'unsigned' not followed by 'int' at column %d.\n",
+ oldpos + 1);
+ return 0;
+ }
+ }
+ else if (strcmp (token, "int"))
+ {
+ (*diag) ("'const' not followed by 'int' at column %d.\n",
+ oldpos + 1);
+ return 0;
+ }
+
+ typedata->base = BT_INT;
+
+ consume_whitespace ();
+ if (linebuf[pos] == '<' || linebuf[pos] == '{' || linebuf[pos] == '[')
+ return match_const_restriction (typedata);
+
+ return 1;
+ }
+
+ consume_whitespace ();
+ return match_basetype (typedata);
+}
+
^ permalink raw reply [flat|nested] 10+ messages in thread
* [gcc(refs/users/wschmidt/heads/builtins3)] rs6000: Add functions for matching types, part 1 of 3
@ 2020-08-28 20:06 William Schmidt
0 siblings, 0 replies; 10+ messages in thread
From: William Schmidt @ 2020-08-28 20:06 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:06c48b9402645e37c14fc167f32165127624713c
commit 06c48b9402645e37c14fc167f32165127624713c
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date: Wed Jun 17 10:01:32 2020 -0500
rs6000: Add functions for matching types, part 1 of 3
2020-07-26 Bill Schmidt <wschmidt@linux.ibm.com>
* config/rs6000/rs6000-gen-builtins.c (void_status): New enum.
(basetype): Likewise.
(typeinfo): New struct.
(handle_pointer): New function.
(match_basetype): New stub function.
(match_const_restriction): Likewise.
(match_type): New function.
Diff:
---
gcc/config/rs6000/rs6000-gen-builtins.c | 382 ++++++++++++++++++++++++++++++++
1 file changed, 382 insertions(+)
diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index e2a9b28eb16..ea1ebedfa52 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -166,6 +166,44 @@ static char linebuf[LINELEN];
static int line;
static int pos;
+/* Used to determine whether a type can be void (only return types). */
+enum void_status {
+ VOID_NOTOK,
+ VOID_OK
+};
+
+/* Legal base types for an argument or return type. */
+enum basetype {
+ BT_CHAR,
+ BT_SHORT,
+ BT_INT,
+ BT_LONGLONG,
+ BT_FLOAT,
+ BT_DOUBLE,
+ BT_INT128,
+ BT_FLOAT128,
+ BT_DECIMAL32,
+ BT_DECIMAL64,
+ BT_DECIMAL128,
+ BT_IBM128
+};
+
+/* Type modifiers for an argument or return type. */
+struct typeinfo {
+ char isvoid;
+ char isconst;
+ char isvector;
+ char issigned;
+ char isunsigned;
+ char isbool;
+ char ispixel;
+ char ispointer;
+ char isopaque;
+ basetype base;
+ int val1;
+ int val2;
+};
+
/* Exit codes for the shell. */
enum exit_codes {
EC_INTERR
@@ -308,3 +346,347 @@ match_to_right_bracket ()
return buf;
}
+static inline void
+handle_pointer (typeinfo *typedata)
+{
+ consume_whitespace ();
+ if (linebuf[pos] == '*')
+ {
+ typedata->ispointer = 1;
+ safe_inc_pos ();
+ }
+}
+
+/* Match one of the allowable base types. Consumes one token unless the
+ token is "long", which must be paired with a second "long". Optionally
+ consumes a following '*' token for pointers. Return 1 for success,
+ 0 for failure. */
+static int
+match_basetype (typeinfo *typedata)
+{
+ return 1;
+}
+
+/* A const int argument may be restricted to certain values. This is
+ indicated by one of the following occurring after the "int' token:
+
+ <x> restricts the constant to x bits, interpreted as unsigned
+ <x,y> restricts the constant to the inclusive range [x,y]
+ [x,y] restricts the constant to the inclusive range [x,y],
+ but only applies if the argument is constant.
+ {x,y} restricts the constant to one of two values, x or y.
+
+ Here x and y are integer tokens. Note that the "const" token is a
+ lie when the restriction is [x,y], but this simplifies the parsing
+ significantly and is hopefully forgivable.
+
+ Return 1 for success, else 0. */
+static int
+match_const_restriction (typeinfo *typedata)
+{
+ return 1;
+}
+
+/* Look for a type, which can be terminated by a token that is not part of
+ a type, a comma, or a closing parenthesis. Place information about the
+ type in TYPEDATA. Return 1 for success, 0 for failure. */
+static int
+match_type (typeinfo *typedata, int voidok)
+{
+ /* A legal type is of the form:
+
+ [const] [[signed|unsigned] <basetype> | <vectype>] [*]
+
+ where "const" applies only to a <basetype> of "int". Legal values
+ of <basetype> are (for now):
+
+ char
+ short
+ int
+ long long
+ float
+ double
+ __int128
+ _Float128
+ _Decimal32
+ _Decimal64
+ _Decimal128
+ __ibm128
+
+ Legal values of <vectype> are as follows, and are shorthand for
+ the associated meaning:
+
+ vsc vector signed char
+ vuc vector unsigned char
+ vbc vector bool char
+ vss vector signed short
+ vus vector unsigned short
+ vbs vector bool short
+ vsi vector signed int
+ vui vector unsigned int
+ vbi vector bool int
+ vsll vector signed long long
+ vull vector unsigned long long
+ vbll vector bool long long
+ vsq vector signed __int128
+ vuq vector unsigned __int128
+ vbq vector bool __int128
+ vp vector pixel
+ vf vector float
+ vd vector double
+ vop opaque vector (matches all vectors)
+
+ For simplicity, We don't support "short int" and "long long int".
+ We don't support a <basetype> of "bool", "long double", or "_Float16",
+ but will add these if builtins require it. "signed" and "unsigned"
+ only apply to integral base types. The optional * indicates a pointer
+ type, which can be used with any base type, but is treated for type
+ signature purposes as a pointer to void. */
+
+ consume_whitespace ();
+ memset (typedata, 0, sizeof(*typedata));
+ int oldpos = pos;
+
+ char *token = match_identifier ();
+ if (!token)
+ return 0;
+
+ if (!strcmp (token, "void"))
+ typedata->isvoid = 1;
+
+ if (!strcmp (token, "const"))
+ {
+ typedata->isconst = 1;
+ consume_whitespace ();
+ oldpos = pos;
+ token = match_identifier ();
+ }
+
+ if (!strcmp (token, "vsc"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vuc"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbc"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vss"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vus"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbs"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vsi"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_INT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vui"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_INT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbi"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_INT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vsll"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_LONGLONG;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vull"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_LONGLONG;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbll"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_LONGLONG;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vsq"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_INT128;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vuq"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_INT128;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbq"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_INT128;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vp"))
+ {
+ typedata->isvector = 1;
+ typedata->ispixel = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vf"))
+ {
+ typedata->isvector = 1;
+ typedata->base = BT_FLOAT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vd"))
+ {
+ typedata->isvector = 1;
+ typedata->base = BT_DOUBLE;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vop"))
+ {
+ typedata->isopaque = 1;
+ return 1;
+ }
+ else if (!strcmp (token, "signed"))
+ typedata->issigned = 1;
+ else if (!strcmp (token, "unsigned"))
+ typedata->isunsigned = 1;
+ else if (!typedata->isvoid && !typedata->isconst)
+ {
+ /* Push back token. */
+ pos = oldpos;
+ return match_basetype (typedata);
+ }
+
+ if (typedata->isvoid)
+ {
+ consume_whitespace ();
+ if (linebuf[pos] == '*')
+ {
+ typedata->ispointer = 1;
+ safe_inc_pos ();
+ }
+ else if (!voidok)
+ return 0;
+ return 1;
+ }
+
+ if (typedata->isconst)
+ {
+ consume_whitespace ();
+ pos = oldpos;
+ token = match_identifier ();
+ if (!strcmp (token, "char"))
+ {
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "signed"))
+ {
+ typedata->issigned = 1;
+ consume_whitespace ();
+ oldpos = pos;
+ token = match_identifier ();
+ if (strcmp (token, "int"))
+ {
+ (*diag) ("'signed' not followed by 'int' at column %d.\n",
+ oldpos + 1);
+ return 0;
+ }
+ }
+ else if (!strcmp (token, "unsigned"))
+ {
+ typedata->isunsigned = 1;
+ consume_whitespace ();
+ oldpos = pos;
+ token = match_identifier ();
+ if (strcmp (token, "int"))
+ {
+ (*diag) ("'unsigned' not followed by 'int' at column %d.\n",
+ oldpos + 1);
+ return 0;
+ }
+ }
+ else if (strcmp (token, "int"))
+ {
+ (*diag) ("'const' not followed by 'int' at column %d.\n",
+ oldpos + 1);
+ return 0;
+ }
+
+ typedata->base = BT_INT;
+
+ consume_whitespace ();
+ if (linebuf[pos] == '<' || linebuf[pos] == '{' || linebuf[pos] == '[')
+ return match_const_restriction (typedata);
+
+ return 1;
+ }
+
+ consume_whitespace ();
+ return match_basetype (typedata);
+}
+
^ permalink raw reply [flat|nested] 10+ messages in thread
* [gcc(refs/users/wschmidt/heads/builtins3)] rs6000: Add functions for matching types, part 1 of 3
@ 2020-08-20 16:37 William Schmidt
0 siblings, 0 replies; 10+ messages in thread
From: William Schmidt @ 2020-08-20 16:37 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:9b695992f147aef5e5eb441efae3eab30b7e5a52
commit 9b695992f147aef5e5eb441efae3eab30b7e5a52
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date: Wed Jun 17 10:01:32 2020 -0500
rs6000: Add functions for matching types, part 1 of 3
2020-07-26 Bill Schmidt <wschmidt@linux.ibm.com>
* config/rs6000/rs6000-gen-builtins.c (void_status): New enum.
(basetype): Likewise.
(typeinfo): New struct.
(handle_pointer): New function.
(match_basetype): New stub function.
(match_const_restriction): Likewise.
(match_type): New function.
Diff:
---
gcc/config/rs6000/rs6000-gen-builtins.c | 382 ++++++++++++++++++++++++++++++++
1 file changed, 382 insertions(+)
diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index e2a9b28eb16..ea1ebedfa52 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -166,6 +166,44 @@ static char linebuf[LINELEN];
static int line;
static int pos;
+/* Used to determine whether a type can be void (only return types). */
+enum void_status {
+ VOID_NOTOK,
+ VOID_OK
+};
+
+/* Legal base types for an argument or return type. */
+enum basetype {
+ BT_CHAR,
+ BT_SHORT,
+ BT_INT,
+ BT_LONGLONG,
+ BT_FLOAT,
+ BT_DOUBLE,
+ BT_INT128,
+ BT_FLOAT128,
+ BT_DECIMAL32,
+ BT_DECIMAL64,
+ BT_DECIMAL128,
+ BT_IBM128
+};
+
+/* Type modifiers for an argument or return type. */
+struct typeinfo {
+ char isvoid;
+ char isconst;
+ char isvector;
+ char issigned;
+ char isunsigned;
+ char isbool;
+ char ispixel;
+ char ispointer;
+ char isopaque;
+ basetype base;
+ int val1;
+ int val2;
+};
+
/* Exit codes for the shell. */
enum exit_codes {
EC_INTERR
@@ -308,3 +346,347 @@ match_to_right_bracket ()
return buf;
}
+static inline void
+handle_pointer (typeinfo *typedata)
+{
+ consume_whitespace ();
+ if (linebuf[pos] == '*')
+ {
+ typedata->ispointer = 1;
+ safe_inc_pos ();
+ }
+}
+
+/* Match one of the allowable base types. Consumes one token unless the
+ token is "long", which must be paired with a second "long". Optionally
+ consumes a following '*' token for pointers. Return 1 for success,
+ 0 for failure. */
+static int
+match_basetype (typeinfo *typedata)
+{
+ return 1;
+}
+
+/* A const int argument may be restricted to certain values. This is
+ indicated by one of the following occurring after the "int' token:
+
+ <x> restricts the constant to x bits, interpreted as unsigned
+ <x,y> restricts the constant to the inclusive range [x,y]
+ [x,y] restricts the constant to the inclusive range [x,y],
+ but only applies if the argument is constant.
+ {x,y} restricts the constant to one of two values, x or y.
+
+ Here x and y are integer tokens. Note that the "const" token is a
+ lie when the restriction is [x,y], but this simplifies the parsing
+ significantly and is hopefully forgivable.
+
+ Return 1 for success, else 0. */
+static int
+match_const_restriction (typeinfo *typedata)
+{
+ return 1;
+}
+
+/* Look for a type, which can be terminated by a token that is not part of
+ a type, a comma, or a closing parenthesis. Place information about the
+ type in TYPEDATA. Return 1 for success, 0 for failure. */
+static int
+match_type (typeinfo *typedata, int voidok)
+{
+ /* A legal type is of the form:
+
+ [const] [[signed|unsigned] <basetype> | <vectype>] [*]
+
+ where "const" applies only to a <basetype> of "int". Legal values
+ of <basetype> are (for now):
+
+ char
+ short
+ int
+ long long
+ float
+ double
+ __int128
+ _Float128
+ _Decimal32
+ _Decimal64
+ _Decimal128
+ __ibm128
+
+ Legal values of <vectype> are as follows, and are shorthand for
+ the associated meaning:
+
+ vsc vector signed char
+ vuc vector unsigned char
+ vbc vector bool char
+ vss vector signed short
+ vus vector unsigned short
+ vbs vector bool short
+ vsi vector signed int
+ vui vector unsigned int
+ vbi vector bool int
+ vsll vector signed long long
+ vull vector unsigned long long
+ vbll vector bool long long
+ vsq vector signed __int128
+ vuq vector unsigned __int128
+ vbq vector bool __int128
+ vp vector pixel
+ vf vector float
+ vd vector double
+ vop opaque vector (matches all vectors)
+
+ For simplicity, We don't support "short int" and "long long int".
+ We don't support a <basetype> of "bool", "long double", or "_Float16",
+ but will add these if builtins require it. "signed" and "unsigned"
+ only apply to integral base types. The optional * indicates a pointer
+ type, which can be used with any base type, but is treated for type
+ signature purposes as a pointer to void. */
+
+ consume_whitespace ();
+ memset (typedata, 0, sizeof(*typedata));
+ int oldpos = pos;
+
+ char *token = match_identifier ();
+ if (!token)
+ return 0;
+
+ if (!strcmp (token, "void"))
+ typedata->isvoid = 1;
+
+ if (!strcmp (token, "const"))
+ {
+ typedata->isconst = 1;
+ consume_whitespace ();
+ oldpos = pos;
+ token = match_identifier ();
+ }
+
+ if (!strcmp (token, "vsc"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vuc"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbc"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vss"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vus"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbs"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vsi"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_INT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vui"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_INT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbi"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_INT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vsll"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_LONGLONG;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vull"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_LONGLONG;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbll"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_LONGLONG;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vsq"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_INT128;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vuq"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_INT128;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbq"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_INT128;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vp"))
+ {
+ typedata->isvector = 1;
+ typedata->ispixel = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vf"))
+ {
+ typedata->isvector = 1;
+ typedata->base = BT_FLOAT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vd"))
+ {
+ typedata->isvector = 1;
+ typedata->base = BT_DOUBLE;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vop"))
+ {
+ typedata->isopaque = 1;
+ return 1;
+ }
+ else if (!strcmp (token, "signed"))
+ typedata->issigned = 1;
+ else if (!strcmp (token, "unsigned"))
+ typedata->isunsigned = 1;
+ else if (!typedata->isvoid && !typedata->isconst)
+ {
+ /* Push back token. */
+ pos = oldpos;
+ return match_basetype (typedata);
+ }
+
+ if (typedata->isvoid)
+ {
+ consume_whitespace ();
+ if (linebuf[pos] == '*')
+ {
+ typedata->ispointer = 1;
+ safe_inc_pos ();
+ }
+ else if (!voidok)
+ return 0;
+ return 1;
+ }
+
+ if (typedata->isconst)
+ {
+ consume_whitespace ();
+ pos = oldpos;
+ token = match_identifier ();
+ if (!strcmp (token, "char"))
+ {
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "signed"))
+ {
+ typedata->issigned = 1;
+ consume_whitespace ();
+ oldpos = pos;
+ token = match_identifier ();
+ if (strcmp (token, "int"))
+ {
+ (*diag) ("'signed' not followed by 'int' at column %d.\n",
+ oldpos + 1);
+ return 0;
+ }
+ }
+ else if (!strcmp (token, "unsigned"))
+ {
+ typedata->isunsigned = 1;
+ consume_whitespace ();
+ oldpos = pos;
+ token = match_identifier ();
+ if (strcmp (token, "int"))
+ {
+ (*diag) ("'unsigned' not followed by 'int' at column %d.\n",
+ oldpos + 1);
+ return 0;
+ }
+ }
+ else if (strcmp (token, "int"))
+ {
+ (*diag) ("'const' not followed by 'int' at column %d.\n",
+ oldpos + 1);
+ return 0;
+ }
+
+ typedata->base = BT_INT;
+
+ consume_whitespace ();
+ if (linebuf[pos] == '<' || linebuf[pos] == '{' || linebuf[pos] == '[')
+ return match_const_restriction (typedata);
+
+ return 1;
+ }
+
+ consume_whitespace ();
+ return match_basetype (typedata);
+}
+
^ permalink raw reply [flat|nested] 10+ messages in thread
* [gcc(refs/users/wschmidt/heads/builtins3)] rs6000: Add functions for matching types, part 1 of 3
@ 2020-08-18 18:43 William Schmidt
0 siblings, 0 replies; 10+ messages in thread
From: William Schmidt @ 2020-08-18 18:43 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:82fbc5eb511c56cc065abe17ecf1c7f56d3e00eb
commit 82fbc5eb511c56cc065abe17ecf1c7f56d3e00eb
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date: Wed Jun 17 10:01:32 2020 -0500
rs6000: Add functions for matching types, part 1 of 3
2020-07-26 Bill Schmidt <wschmidt@linux.ibm.com>
* config/rs6000/rs6000-gen-builtins.c (void_status): New enum.
(basetype): Likewise.
(typeinfo): New struct.
(handle_pointer): New function.
(match_basetype): New stub function.
(match_const_restriction): Likewise.
(match_type): New function.
Diff:
---
gcc/config/rs6000/rs6000-gen-builtins.c | 382 ++++++++++++++++++++++++++++++++
1 file changed, 382 insertions(+)
diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index e2a9b28eb16..ea1ebedfa52 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -166,6 +166,44 @@ static char linebuf[LINELEN];
static int line;
static int pos;
+/* Used to determine whether a type can be void (only return types). */
+enum void_status {
+ VOID_NOTOK,
+ VOID_OK
+};
+
+/* Legal base types for an argument or return type. */
+enum basetype {
+ BT_CHAR,
+ BT_SHORT,
+ BT_INT,
+ BT_LONGLONG,
+ BT_FLOAT,
+ BT_DOUBLE,
+ BT_INT128,
+ BT_FLOAT128,
+ BT_DECIMAL32,
+ BT_DECIMAL64,
+ BT_DECIMAL128,
+ BT_IBM128
+};
+
+/* Type modifiers for an argument or return type. */
+struct typeinfo {
+ char isvoid;
+ char isconst;
+ char isvector;
+ char issigned;
+ char isunsigned;
+ char isbool;
+ char ispixel;
+ char ispointer;
+ char isopaque;
+ basetype base;
+ int val1;
+ int val2;
+};
+
/* Exit codes for the shell. */
enum exit_codes {
EC_INTERR
@@ -308,3 +346,347 @@ match_to_right_bracket ()
return buf;
}
+static inline void
+handle_pointer (typeinfo *typedata)
+{
+ consume_whitespace ();
+ if (linebuf[pos] == '*')
+ {
+ typedata->ispointer = 1;
+ safe_inc_pos ();
+ }
+}
+
+/* Match one of the allowable base types. Consumes one token unless the
+ token is "long", which must be paired with a second "long". Optionally
+ consumes a following '*' token for pointers. Return 1 for success,
+ 0 for failure. */
+static int
+match_basetype (typeinfo *typedata)
+{
+ return 1;
+}
+
+/* A const int argument may be restricted to certain values. This is
+ indicated by one of the following occurring after the "int' token:
+
+ <x> restricts the constant to x bits, interpreted as unsigned
+ <x,y> restricts the constant to the inclusive range [x,y]
+ [x,y] restricts the constant to the inclusive range [x,y],
+ but only applies if the argument is constant.
+ {x,y} restricts the constant to one of two values, x or y.
+
+ Here x and y are integer tokens. Note that the "const" token is a
+ lie when the restriction is [x,y], but this simplifies the parsing
+ significantly and is hopefully forgivable.
+
+ Return 1 for success, else 0. */
+static int
+match_const_restriction (typeinfo *typedata)
+{
+ return 1;
+}
+
+/* Look for a type, which can be terminated by a token that is not part of
+ a type, a comma, or a closing parenthesis. Place information about the
+ type in TYPEDATA. Return 1 for success, 0 for failure. */
+static int
+match_type (typeinfo *typedata, int voidok)
+{
+ /* A legal type is of the form:
+
+ [const] [[signed|unsigned] <basetype> | <vectype>] [*]
+
+ where "const" applies only to a <basetype> of "int". Legal values
+ of <basetype> are (for now):
+
+ char
+ short
+ int
+ long long
+ float
+ double
+ __int128
+ _Float128
+ _Decimal32
+ _Decimal64
+ _Decimal128
+ __ibm128
+
+ Legal values of <vectype> are as follows, and are shorthand for
+ the associated meaning:
+
+ vsc vector signed char
+ vuc vector unsigned char
+ vbc vector bool char
+ vss vector signed short
+ vus vector unsigned short
+ vbs vector bool short
+ vsi vector signed int
+ vui vector unsigned int
+ vbi vector bool int
+ vsll vector signed long long
+ vull vector unsigned long long
+ vbll vector bool long long
+ vsq vector signed __int128
+ vuq vector unsigned __int128
+ vbq vector bool __int128
+ vp vector pixel
+ vf vector float
+ vd vector double
+ vop opaque vector (matches all vectors)
+
+ For simplicity, We don't support "short int" and "long long int".
+ We don't support a <basetype> of "bool", "long double", or "_Float16",
+ but will add these if builtins require it. "signed" and "unsigned"
+ only apply to integral base types. The optional * indicates a pointer
+ type, which can be used with any base type, but is treated for type
+ signature purposes as a pointer to void. */
+
+ consume_whitespace ();
+ memset (typedata, 0, sizeof(*typedata));
+ int oldpos = pos;
+
+ char *token = match_identifier ();
+ if (!token)
+ return 0;
+
+ if (!strcmp (token, "void"))
+ typedata->isvoid = 1;
+
+ if (!strcmp (token, "const"))
+ {
+ typedata->isconst = 1;
+ consume_whitespace ();
+ oldpos = pos;
+ token = match_identifier ();
+ }
+
+ if (!strcmp (token, "vsc"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vuc"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbc"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vss"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vus"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbs"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vsi"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_INT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vui"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_INT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbi"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_INT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vsll"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_LONGLONG;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vull"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_LONGLONG;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbll"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_LONGLONG;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vsq"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_INT128;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vuq"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_INT128;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbq"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_INT128;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vp"))
+ {
+ typedata->isvector = 1;
+ typedata->ispixel = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vf"))
+ {
+ typedata->isvector = 1;
+ typedata->base = BT_FLOAT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vd"))
+ {
+ typedata->isvector = 1;
+ typedata->base = BT_DOUBLE;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vop"))
+ {
+ typedata->isopaque = 1;
+ return 1;
+ }
+ else if (!strcmp (token, "signed"))
+ typedata->issigned = 1;
+ else if (!strcmp (token, "unsigned"))
+ typedata->isunsigned = 1;
+ else if (!typedata->isvoid && !typedata->isconst)
+ {
+ /* Push back token. */
+ pos = oldpos;
+ return match_basetype (typedata);
+ }
+
+ if (typedata->isvoid)
+ {
+ consume_whitespace ();
+ if (linebuf[pos] == '*')
+ {
+ typedata->ispointer = 1;
+ safe_inc_pos ();
+ }
+ else if (!voidok)
+ return 0;
+ return 1;
+ }
+
+ if (typedata->isconst)
+ {
+ consume_whitespace ();
+ pos = oldpos;
+ token = match_identifier ();
+ if (!strcmp (token, "char"))
+ {
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "signed"))
+ {
+ typedata->issigned = 1;
+ consume_whitespace ();
+ oldpos = pos;
+ token = match_identifier ();
+ if (strcmp (token, "int"))
+ {
+ (*diag) ("'signed' not followed by 'int' at column %d.\n",
+ oldpos + 1);
+ return 0;
+ }
+ }
+ else if (!strcmp (token, "unsigned"))
+ {
+ typedata->isunsigned = 1;
+ consume_whitespace ();
+ oldpos = pos;
+ token = match_identifier ();
+ if (strcmp (token, "int"))
+ {
+ (*diag) ("'unsigned' not followed by 'int' at column %d.\n",
+ oldpos + 1);
+ return 0;
+ }
+ }
+ else if (strcmp (token, "int"))
+ {
+ (*diag) ("'const' not followed by 'int' at column %d.\n",
+ oldpos + 1);
+ return 0;
+ }
+
+ typedata->base = BT_INT;
+
+ consume_whitespace ();
+ if (linebuf[pos] == '<' || linebuf[pos] == '{' || linebuf[pos] == '[')
+ return match_const_restriction (typedata);
+
+ return 1;
+ }
+
+ consume_whitespace ();
+ return match_basetype (typedata);
+}
+
^ permalink raw reply [flat|nested] 10+ messages in thread
* [gcc(refs/users/wschmidt/heads/builtins3)] rs6000: Add functions for matching types, part 1 of 3
@ 2020-07-27 18:46 William Schmidt
0 siblings, 0 replies; 10+ messages in thread
From: William Schmidt @ 2020-07-27 18:46 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:97ab133010e95f8e5b717b6d2870b6bfcc6110fb
commit 97ab133010e95f8e5b717b6d2870b6bfcc6110fb
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date: Wed Jun 17 10:01:32 2020 -0500
rs6000: Add functions for matching types, part 1 of 3
2020-07-26 Bill Schmidt <wschmidt@linux.ibm.com>
* config/rs6000/rs6000-gen-builtins.c (void_status): New enum.
(basetype): Likewise.
(typeinfo): New struct.
(handle_pointer): New function.
(match_basetype): New stub function.
(match_const_restriction): Likewise.
(match_type): New function.
Diff:
---
gcc/config/rs6000/rs6000-gen-builtins.c | 382 ++++++++++++++++++++++++++++++++
1 file changed, 382 insertions(+)
diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index e2a9b28eb16..ea1ebedfa52 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -166,6 +166,44 @@ static char linebuf[LINELEN];
static int line;
static int pos;
+/* Used to determine whether a type can be void (only return types). */
+enum void_status {
+ VOID_NOTOK,
+ VOID_OK
+};
+
+/* Legal base types for an argument or return type. */
+enum basetype {
+ BT_CHAR,
+ BT_SHORT,
+ BT_INT,
+ BT_LONGLONG,
+ BT_FLOAT,
+ BT_DOUBLE,
+ BT_INT128,
+ BT_FLOAT128,
+ BT_DECIMAL32,
+ BT_DECIMAL64,
+ BT_DECIMAL128,
+ BT_IBM128
+};
+
+/* Type modifiers for an argument or return type. */
+struct typeinfo {
+ char isvoid;
+ char isconst;
+ char isvector;
+ char issigned;
+ char isunsigned;
+ char isbool;
+ char ispixel;
+ char ispointer;
+ char isopaque;
+ basetype base;
+ int val1;
+ int val2;
+};
+
/* Exit codes for the shell. */
enum exit_codes {
EC_INTERR
@@ -308,3 +346,347 @@ match_to_right_bracket ()
return buf;
}
+static inline void
+handle_pointer (typeinfo *typedata)
+{
+ consume_whitespace ();
+ if (linebuf[pos] == '*')
+ {
+ typedata->ispointer = 1;
+ safe_inc_pos ();
+ }
+}
+
+/* Match one of the allowable base types. Consumes one token unless the
+ token is "long", which must be paired with a second "long". Optionally
+ consumes a following '*' token for pointers. Return 1 for success,
+ 0 for failure. */
+static int
+match_basetype (typeinfo *typedata)
+{
+ return 1;
+}
+
+/* A const int argument may be restricted to certain values. This is
+ indicated by one of the following occurring after the "int' token:
+
+ <x> restricts the constant to x bits, interpreted as unsigned
+ <x,y> restricts the constant to the inclusive range [x,y]
+ [x,y] restricts the constant to the inclusive range [x,y],
+ but only applies if the argument is constant.
+ {x,y} restricts the constant to one of two values, x or y.
+
+ Here x and y are integer tokens. Note that the "const" token is a
+ lie when the restriction is [x,y], but this simplifies the parsing
+ significantly and is hopefully forgivable.
+
+ Return 1 for success, else 0. */
+static int
+match_const_restriction (typeinfo *typedata)
+{
+ return 1;
+}
+
+/* Look for a type, which can be terminated by a token that is not part of
+ a type, a comma, or a closing parenthesis. Place information about the
+ type in TYPEDATA. Return 1 for success, 0 for failure. */
+static int
+match_type (typeinfo *typedata, int voidok)
+{
+ /* A legal type is of the form:
+
+ [const] [[signed|unsigned] <basetype> | <vectype>] [*]
+
+ where "const" applies only to a <basetype> of "int". Legal values
+ of <basetype> are (for now):
+
+ char
+ short
+ int
+ long long
+ float
+ double
+ __int128
+ _Float128
+ _Decimal32
+ _Decimal64
+ _Decimal128
+ __ibm128
+
+ Legal values of <vectype> are as follows, and are shorthand for
+ the associated meaning:
+
+ vsc vector signed char
+ vuc vector unsigned char
+ vbc vector bool char
+ vss vector signed short
+ vus vector unsigned short
+ vbs vector bool short
+ vsi vector signed int
+ vui vector unsigned int
+ vbi vector bool int
+ vsll vector signed long long
+ vull vector unsigned long long
+ vbll vector bool long long
+ vsq vector signed __int128
+ vuq vector unsigned __int128
+ vbq vector bool __int128
+ vp vector pixel
+ vf vector float
+ vd vector double
+ vop opaque vector (matches all vectors)
+
+ For simplicity, We don't support "short int" and "long long int".
+ We don't support a <basetype> of "bool", "long double", or "_Float16",
+ but will add these if builtins require it. "signed" and "unsigned"
+ only apply to integral base types. The optional * indicates a pointer
+ type, which can be used with any base type, but is treated for type
+ signature purposes as a pointer to void. */
+
+ consume_whitespace ();
+ memset (typedata, 0, sizeof(*typedata));
+ int oldpos = pos;
+
+ char *token = match_identifier ();
+ if (!token)
+ return 0;
+
+ if (!strcmp (token, "void"))
+ typedata->isvoid = 1;
+
+ if (!strcmp (token, "const"))
+ {
+ typedata->isconst = 1;
+ consume_whitespace ();
+ oldpos = pos;
+ token = match_identifier ();
+ }
+
+ if (!strcmp (token, "vsc"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vuc"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbc"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vss"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vus"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbs"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vsi"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_INT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vui"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_INT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbi"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_INT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vsll"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_LONGLONG;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vull"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_LONGLONG;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbll"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_LONGLONG;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vsq"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_INT128;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vuq"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_INT128;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbq"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_INT128;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vp"))
+ {
+ typedata->isvector = 1;
+ typedata->ispixel = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vf"))
+ {
+ typedata->isvector = 1;
+ typedata->base = BT_FLOAT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vd"))
+ {
+ typedata->isvector = 1;
+ typedata->base = BT_DOUBLE;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vop"))
+ {
+ typedata->isopaque = 1;
+ return 1;
+ }
+ else if (!strcmp (token, "signed"))
+ typedata->issigned = 1;
+ else if (!strcmp (token, "unsigned"))
+ typedata->isunsigned = 1;
+ else if (!typedata->isvoid && !typedata->isconst)
+ {
+ /* Push back token. */
+ pos = oldpos;
+ return match_basetype (typedata);
+ }
+
+ if (typedata->isvoid)
+ {
+ consume_whitespace ();
+ if (linebuf[pos] == '*')
+ {
+ typedata->ispointer = 1;
+ safe_inc_pos ();
+ }
+ else if (!voidok)
+ return 0;
+ return 1;
+ }
+
+ if (typedata->isconst)
+ {
+ consume_whitespace ();
+ pos = oldpos;
+ token = match_identifier ();
+ if (!strcmp (token, "char"))
+ {
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "signed"))
+ {
+ typedata->issigned = 1;
+ consume_whitespace ();
+ oldpos = pos;
+ token = match_identifier ();
+ if (strcmp (token, "int"))
+ {
+ (*diag) ("'signed' not followed by 'int' at column %d.\n",
+ oldpos + 1);
+ return 0;
+ }
+ }
+ else if (!strcmp (token, "unsigned"))
+ {
+ typedata->isunsigned = 1;
+ consume_whitespace ();
+ oldpos = pos;
+ token = match_identifier ();
+ if (strcmp (token, "int"))
+ {
+ (*diag) ("'unsigned' not followed by 'int' at column %d.\n",
+ oldpos + 1);
+ return 0;
+ }
+ }
+ else if (strcmp (token, "int"))
+ {
+ (*diag) ("'const' not followed by 'int' at column %d.\n",
+ oldpos + 1);
+ return 0;
+ }
+
+ typedata->base = BT_INT;
+
+ consume_whitespace ();
+ if (linebuf[pos] == '<' || linebuf[pos] == '{' || linebuf[pos] == '[')
+ return match_const_restriction (typedata);
+
+ return 1;
+ }
+
+ consume_whitespace ();
+ return match_basetype (typedata);
+}
+
^ permalink raw reply [flat|nested] 10+ messages in thread
* [gcc(refs/users/wschmidt/heads/builtins3)] rs6000: Add functions for matching types, part 1 of 3
@ 2020-07-17 17:21 William Schmidt
0 siblings, 0 replies; 10+ messages in thread
From: William Schmidt @ 2020-07-17 17:21 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:94ddc0023fbd3883fca72d05312f888579121119
commit 94ddc0023fbd3883fca72d05312f888579121119
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date: Wed Jun 17 10:01:32 2020 -0500
rs6000: Add functions for matching types, part 1 of 3
2020-06-17 Bill Schmidt <wschmidt@linux.ibm.com>
* config/rs6000/rs6000-gen-builtins.c (void_status): New enum.
(basetype): Likewise.
(typeinfo): New struct.
(handle_pointer): New function.
(match_basetype): New stub function.
(match_const_restriction): Likewise.
(match_type): New function.
Diff:
---
gcc/config/rs6000/rs6000-gen-builtins.c | 382 ++++++++++++++++++++++++++++++++
1 file changed, 382 insertions(+)
diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index 6b38a7f6101..56938de55f2 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -167,6 +167,44 @@ static char linebuf[LINELEN];
static int line;
static int pos;
+/* Used to determine whether a type can be void (only return types). */
+enum void_status {
+ VOID_NOTOK,
+ VOID_OK
+};
+
+/* Legal base types for an argument or return type. */
+enum basetype {
+ BT_CHAR,
+ BT_SHORT,
+ BT_INT,
+ BT_LONGLONG,
+ BT_FLOAT,
+ BT_DOUBLE,
+ BT_INT128,
+ BT_FLOAT128,
+ BT_DECIMAL32,
+ BT_DECIMAL64,
+ BT_DECIMAL128,
+ BT_IBM128
+};
+
+/* Type modifiers for an argument or return type. */
+struct typeinfo {
+ char isvoid;
+ char isconst;
+ char isvector;
+ char issigned;
+ char isunsigned;
+ char isbool;
+ char ispixel;
+ char ispointer;
+ char isopaque;
+ basetype base;
+ int val1;
+ int val2;
+};
+
/* Exit codes for the shell. */
enum exit_codes {
EC_INTERR
@@ -309,3 +347,347 @@ match_to_right_bracket ()
return buf;
}
+static inline void
+handle_pointer (typeinfo *typedata)
+{
+ consume_whitespace ();
+ if (linebuf[pos] == '*')
+ {
+ typedata->ispointer = 1;
+ safe_inc_pos ();
+ }
+}
+
+/* Match one of the allowable base types. Consumes one token unless the
+ token is "long", which must be paired with a second "long". Optionally
+ consumes a following '*' token for pointers. Return 1 for success,
+ 0 for failure. */
+static int
+match_basetype (typeinfo *typedata)
+{
+ return 1;
+}
+
+/* A const int argument may be restricted to certain values. This is
+ indicated by one of the following occurring after the "int' token:
+
+ <x> restricts the constant to x bits, interpreted as unsigned
+ <x,y> restricts the constant to the inclusive range [x,y]
+ [x,y] restricts the constant to the inclusive range [x,y],
+ but only applies if the argument is constant.
+ {x,y} restricts the constant to one of two values, x or y.
+
+ Here x and y are integer tokens. Note that the "const" token is a
+ lie when the restriction is [x,y], but this simplifies the parsing
+ significantly and is hopefully forgivable.
+
+ Return 1 for success, else 0. */
+static int
+match_const_restriction (typeinfo *typedata)
+{
+ return 1;
+}
+
+/* Look for a type, which can be terminated by a token that is not part of
+ a type, a comma, or a closing parenthesis. Place information about the
+ type in TYPEDATA. Return 1 for success, 0 for failure. */
+static int
+match_type (typeinfo *typedata, int voidok)
+{
+ /* A legal type is of the form:
+
+ [const] [[signed|unsigned] <basetype> | <vectype>] [*]
+
+ where "const" applies only to a <basetype> of "int". Legal values
+ of <basetype> are (for now):
+
+ char
+ short
+ int
+ long long
+ float
+ double
+ __int128
+ _Float128
+ _Decimal32
+ _Decimal64
+ _Decimal128
+ __ibm128
+
+ Legal values of <vectype> are as follows, and are shorthand for
+ the associated meaning:
+
+ vsc vector signed char
+ vuc vector unsigned char
+ vbc vector bool char
+ vss vector signed short
+ vus vector unsigned short
+ vbs vector bool short
+ vsi vector signed int
+ vui vector unsigned int
+ vbi vector bool int
+ vsll vector signed long long
+ vull vector unsigned long long
+ vbll vector bool long long
+ vsq vector signed __int128
+ vuq vector unsigned __int128
+ vbq vector bool __int128
+ vp vector pixel
+ vf vector float
+ vd vector double
+ vop opaque vector (matches all vectors)
+
+ For simplicity, We don't support "short int" and "long long int".
+ We don't support a <basetype> of "bool", "long double", or "_Float16",
+ but will add these if builtins require it. "signed" and "unsigned"
+ only apply to integral base types. The optional * indicates a pointer
+ type, which can be used with any base type, but is treated for type
+ signature purposes as a pointer to void. */
+
+ consume_whitespace ();
+ memset (typedata, 0, sizeof(*typedata));
+ int oldpos = pos;
+
+ char *token = match_identifier ();
+ if (!token)
+ return 0;
+
+ if (!strcmp (token, "void"))
+ typedata->isvoid = 1;
+
+ if (!strcmp (token, "const"))
+ {
+ typedata->isconst = 1;
+ consume_whitespace ();
+ oldpos = pos;
+ token = match_identifier ();
+ }
+
+ if (!strcmp (token, "vsc"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vuc"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbc"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vss"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vus"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbs"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vsi"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_INT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vui"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_INT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbi"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_INT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vsll"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_LONGLONG;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vull"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_LONGLONG;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbll"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_LONGLONG;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vsq"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_INT128;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vuq"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_INT128;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbq"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_INT128;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vp"))
+ {
+ typedata->isvector = 1;
+ typedata->ispixel = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vf"))
+ {
+ typedata->isvector = 1;
+ typedata->base = BT_FLOAT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vd"))
+ {
+ typedata->isvector = 1;
+ typedata->base = BT_DOUBLE;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vop"))
+ {
+ typedata->isopaque = 1;
+ return 1;
+ }
+ else if (!strcmp (token, "signed"))
+ typedata->issigned = 1;
+ else if (!strcmp (token, "unsigned"))
+ typedata->isunsigned = 1;
+ else if (!typedata->isvoid && !typedata->isconst)
+ {
+ /* Push back token. */
+ pos = oldpos;
+ return match_basetype (typedata);
+ }
+
+ if (typedata->isvoid)
+ {
+ consume_whitespace ();
+ if (linebuf[pos] == '*')
+ {
+ typedata->ispointer = 1;
+ safe_inc_pos ();
+ }
+ else if (!voidok)
+ return 0;
+ return 1;
+ }
+
+ if (typedata->isconst)
+ {
+ consume_whitespace ();
+ pos = oldpos;
+ token = match_identifier ();
+ if (!strcmp (token, "char"))
+ {
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "signed"))
+ {
+ typedata->issigned = 1;
+ consume_whitespace ();
+ oldpos = pos;
+ token = match_identifier ();
+ if (strcmp (token, "int"))
+ {
+ (*diag) ("'signed' not followed by 'int' at column %d.\n",
+ oldpos + 1);
+ return 0;
+ }
+ }
+ else if (!strcmp (token, "unsigned"))
+ {
+ typedata->isunsigned = 1;
+ consume_whitespace ();
+ oldpos = pos;
+ token = match_identifier ();
+ if (strcmp (token, "int"))
+ {
+ (*diag) ("'unsigned' not followed by 'int' at column %d.\n",
+ oldpos + 1);
+ return 0;
+ }
+ }
+ else if (strcmp (token, "int"))
+ {
+ (*diag) ("'const' not followed by 'int' at column %d.\n",
+ oldpos + 1);
+ return 0;
+ }
+
+ typedata->base = BT_INT;
+
+ consume_whitespace ();
+ if (linebuf[pos] == '<' || linebuf[pos] == '{' || linebuf[pos] == '[')
+ return match_const_restriction (typedata);
+
+ return 1;
+ }
+
+ consume_whitespace ();
+ return match_basetype (typedata);
+}
+
^ permalink raw reply [flat|nested] 10+ messages in thread
* [gcc(refs/users/wschmidt/heads/builtins3)] rs6000: Add functions for matching types, part 1 of 3
@ 2020-06-17 20:04 William Schmidt
0 siblings, 0 replies; 10+ messages in thread
From: William Schmidt @ 2020-06-17 20:04 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:dc2a92e0616c2dcd6df5996e1ae864676ba2a940
commit dc2a92e0616c2dcd6df5996e1ae864676ba2a940
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date: Wed Jun 17 10:01:32 2020 -0500
rs6000: Add functions for matching types, part 1 of 3
2020-06-17 Bill Schmidt <wschmidt@linux.ibm.com>
* config/rs6000/rs6000-gen-builtins.c (void_status): New enum.
(basetype): Likewise.
(typeinfo): New struct.
(handle_pointer): New function.
(match_basetype): New stub function.
(match_const_restriction): Likewise.
(match_type): New function.
Diff:
---
gcc/config/rs6000/rs6000-gen-builtins.c | 382 ++++++++++++++++++++++++++++++++
1 file changed, 382 insertions(+)
diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index 6b38a7f6101..56938de55f2 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -167,6 +167,44 @@ static char linebuf[LINELEN];
static int line;
static int pos;
+/* Used to determine whether a type can be void (only return types). */
+enum void_status {
+ VOID_NOTOK,
+ VOID_OK
+};
+
+/* Legal base types for an argument or return type. */
+enum basetype {
+ BT_CHAR,
+ BT_SHORT,
+ BT_INT,
+ BT_LONGLONG,
+ BT_FLOAT,
+ BT_DOUBLE,
+ BT_INT128,
+ BT_FLOAT128,
+ BT_DECIMAL32,
+ BT_DECIMAL64,
+ BT_DECIMAL128,
+ BT_IBM128
+};
+
+/* Type modifiers for an argument or return type. */
+struct typeinfo {
+ char isvoid;
+ char isconst;
+ char isvector;
+ char issigned;
+ char isunsigned;
+ char isbool;
+ char ispixel;
+ char ispointer;
+ char isopaque;
+ basetype base;
+ int val1;
+ int val2;
+};
+
/* Exit codes for the shell. */
enum exit_codes {
EC_INTERR
@@ -309,3 +347,347 @@ match_to_right_bracket ()
return buf;
}
+static inline void
+handle_pointer (typeinfo *typedata)
+{
+ consume_whitespace ();
+ if (linebuf[pos] == '*')
+ {
+ typedata->ispointer = 1;
+ safe_inc_pos ();
+ }
+}
+
+/* Match one of the allowable base types. Consumes one token unless the
+ token is "long", which must be paired with a second "long". Optionally
+ consumes a following '*' token for pointers. Return 1 for success,
+ 0 for failure. */
+static int
+match_basetype (typeinfo *typedata)
+{
+ return 1;
+}
+
+/* A const int argument may be restricted to certain values. This is
+ indicated by one of the following occurring after the "int' token:
+
+ <x> restricts the constant to x bits, interpreted as unsigned
+ <x,y> restricts the constant to the inclusive range [x,y]
+ [x,y] restricts the constant to the inclusive range [x,y],
+ but only applies if the argument is constant.
+ {x,y} restricts the constant to one of two values, x or y.
+
+ Here x and y are integer tokens. Note that the "const" token is a
+ lie when the restriction is [x,y], but this simplifies the parsing
+ significantly and is hopefully forgivable.
+
+ Return 1 for success, else 0. */
+static int
+match_const_restriction (typeinfo *typedata)
+{
+ return 1;
+}
+
+/* Look for a type, which can be terminated by a token that is not part of
+ a type, a comma, or a closing parenthesis. Place information about the
+ type in TYPEDATA. Return 1 for success, 0 for failure. */
+static int
+match_type (typeinfo *typedata, int voidok)
+{
+ /* A legal type is of the form:
+
+ [const] [[signed|unsigned] <basetype> | <vectype>] [*]
+
+ where "const" applies only to a <basetype> of "int". Legal values
+ of <basetype> are (for now):
+
+ char
+ short
+ int
+ long long
+ float
+ double
+ __int128
+ _Float128
+ _Decimal32
+ _Decimal64
+ _Decimal128
+ __ibm128
+
+ Legal values of <vectype> are as follows, and are shorthand for
+ the associated meaning:
+
+ vsc vector signed char
+ vuc vector unsigned char
+ vbc vector bool char
+ vss vector signed short
+ vus vector unsigned short
+ vbs vector bool short
+ vsi vector signed int
+ vui vector unsigned int
+ vbi vector bool int
+ vsll vector signed long long
+ vull vector unsigned long long
+ vbll vector bool long long
+ vsq vector signed __int128
+ vuq vector unsigned __int128
+ vbq vector bool __int128
+ vp vector pixel
+ vf vector float
+ vd vector double
+ vop opaque vector (matches all vectors)
+
+ For simplicity, We don't support "short int" and "long long int".
+ We don't support a <basetype> of "bool", "long double", or "_Float16",
+ but will add these if builtins require it. "signed" and "unsigned"
+ only apply to integral base types. The optional * indicates a pointer
+ type, which can be used with any base type, but is treated for type
+ signature purposes as a pointer to void. */
+
+ consume_whitespace ();
+ memset (typedata, 0, sizeof(*typedata));
+ int oldpos = pos;
+
+ char *token = match_identifier ();
+ if (!token)
+ return 0;
+
+ if (!strcmp (token, "void"))
+ typedata->isvoid = 1;
+
+ if (!strcmp (token, "const"))
+ {
+ typedata->isconst = 1;
+ consume_whitespace ();
+ oldpos = pos;
+ token = match_identifier ();
+ }
+
+ if (!strcmp (token, "vsc"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vuc"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbc"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vss"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vus"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbs"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vsi"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_INT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vui"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_INT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbi"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_INT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vsll"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_LONGLONG;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vull"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_LONGLONG;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbll"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_LONGLONG;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vsq"))
+ {
+ typedata->isvector = 1;
+ typedata->issigned = 1;
+ typedata->base = BT_INT128;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vuq"))
+ {
+ typedata->isvector = 1;
+ typedata->isunsigned = 1;
+ typedata->base = BT_INT128;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vbq"))
+ {
+ typedata->isvector = 1;
+ typedata->isbool = 1;
+ typedata->base = BT_INT128;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vp"))
+ {
+ typedata->isvector = 1;
+ typedata->ispixel = 1;
+ typedata->base = BT_SHORT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vf"))
+ {
+ typedata->isvector = 1;
+ typedata->base = BT_FLOAT;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vd"))
+ {
+ typedata->isvector = 1;
+ typedata->base = BT_DOUBLE;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "vop"))
+ {
+ typedata->isopaque = 1;
+ return 1;
+ }
+ else if (!strcmp (token, "signed"))
+ typedata->issigned = 1;
+ else if (!strcmp (token, "unsigned"))
+ typedata->isunsigned = 1;
+ else if (!typedata->isvoid && !typedata->isconst)
+ {
+ /* Push back token. */
+ pos = oldpos;
+ return match_basetype (typedata);
+ }
+
+ if (typedata->isvoid)
+ {
+ consume_whitespace ();
+ if (linebuf[pos] == '*')
+ {
+ typedata->ispointer = 1;
+ safe_inc_pos ();
+ }
+ else if (!voidok)
+ return 0;
+ return 1;
+ }
+
+ if (typedata->isconst)
+ {
+ consume_whitespace ();
+ pos = oldpos;
+ token = match_identifier ();
+ if (!strcmp (token, "char"))
+ {
+ typedata->base = BT_CHAR;
+ handle_pointer (typedata);
+ return 1;
+ }
+ else if (!strcmp (token, "signed"))
+ {
+ typedata->issigned = 1;
+ consume_whitespace ();
+ oldpos = pos;
+ token = match_identifier ();
+ if (strcmp (token, "int"))
+ {
+ (*diag) ("'signed' not followed by 'int' at column %d.\n",
+ oldpos + 1);
+ return 0;
+ }
+ }
+ else if (!strcmp (token, "unsigned"))
+ {
+ typedata->isunsigned = 1;
+ consume_whitespace ();
+ oldpos = pos;
+ token = match_identifier ();
+ if (strcmp (token, "int"))
+ {
+ (*diag) ("'unsigned' not followed by 'int' at column %d.\n",
+ oldpos + 1);
+ return 0;
+ }
+ }
+ else if (strcmp (token, "int"))
+ {
+ (*diag) ("'const' not followed by 'int' at column %d.\n",
+ oldpos + 1);
+ return 0;
+ }
+
+ typedata->base = BT_INT;
+
+ consume_whitespace ();
+ if (linebuf[pos] == '<' || linebuf[pos] == '{' || linebuf[pos] == '[')
+ return match_const_restriction (typedata);
+
+ return 1;
+ }
+
+ consume_whitespace ();
+ return match_basetype (typedata);
+}
+
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2020-10-29 19:49 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-14 13:57 [gcc(refs/users/wschmidt/heads/builtins3)] rs6000: Add functions for matching types, part 1 of 3 William Schmidt
-- strict thread matches above, loose matches on Subject: below --
2020-10-29 19:49 William Schmidt
2020-10-27 16:27 William Schmidt
2020-09-16 21:28 William Schmidt
2020-08-28 20:06 William Schmidt
2020-08-20 16:37 William Schmidt
2020-08-18 18:43 William Schmidt
2020-07-27 18:46 William Schmidt
2020-07-17 17:21 William Schmidt
2020-06-17 20:04 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).