From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1725) id 84B00383A816; Fri, 25 Jun 2021 16:15:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 84B00383A816 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: William Schmidt To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/wschmidt/heads/builtins10)] rs6000: Add functions for matching types, part 2 of 3 X-Act-Checkin: gcc X-Git-Author: Bill Schmidt X-Git-Refname: refs/users/wschmidt/heads/builtins10 X-Git-Oldrev: c4d5d38e2992320479dce33aff187bdd05280eb1 X-Git-Newrev: a8c3b8a294106d3f85bf4780f8deb58c64e252c6 Message-Id: <20210625161519.84B00383A816@sourceware.org> Date: Fri, 25 Jun 2021 16:15:19 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Jun 2021 16:15:19 -0000 https://gcc.gnu.org/g:a8c3b8a294106d3f85bf4780f8deb58c64e252c6 commit a8c3b8a294106d3f85bf4780f8deb58c64e252c6 Author: Bill Schmidt Date: Fri Apr 2 16:31:38 2021 -0500 rs6000: Add functions for matching types, part 2 of 3 2021-04-02 Bill Schmidt gcc/ * config/rs6000/rs6000-gen-builtins.c (match_basetype): Implement. Diff: --- gcc/config/rs6000/rs6000-gen-builtins.c | 64 +++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c index 38363f034d3..f850ea86a39 100644 --- a/gcc/config/rs6000/rs6000-gen-builtins.c +++ b/gcc/config/rs6000/rs6000-gen-builtins.c @@ -386,6 +386,70 @@ handle_pointer (typeinfo *typedata) static int match_basetype (typeinfo *typedata) { + consume_whitespace (); + int oldpos = pos; + char *token = match_identifier (); + if (!token) + { + (*diag) ("missing base type in return type at column %d\n", pos + 1); + return 0; + } + + if (!strcmp (token, "char")) + typedata->base = BT_CHAR; + else if (!strcmp (token, "short")) + typedata->base = BT_SHORT; + else if (!strcmp (token, "int")) + typedata->base = BT_INT; + else if (!strcmp (token, "long")) + { + consume_whitespace (); + oldpos = pos; + char *mustbelongordbl = match_identifier (); + if (!mustbelongordbl) + typedata->base = BT_LONG; + else if (!strcmp (mustbelongordbl, "long")) + typedata->base = BT_LONGLONG; + else if (!strcmp (mustbelongordbl, "double")) + typedata->base = BT_LONGDOUBLE; + else + /* Speculatively accept "long" here and push back the token. + This occurs when "long" is a return type and the next token + is the function name. */ + { + typedata->base = BT_LONG; + pos = oldpos; + } + } + else if (!strcmp (token, "float")) + typedata->base = BT_FLOAT; + else if (!strcmp (token, "double")) + typedata->base = BT_DOUBLE; + else if (!strcmp (token, "__int128")) + typedata->base = BT_INT128; + else if (!strcmp (token, "_Float128")) + typedata->base = BT_FLOAT128; + else if (!strcmp (token, "bool")) + typedata->base = BT_BOOL; + /* A "string" is a special "const char *" -- we need it because it + cannot match either signed or unsigned char *. */ + else if (!strcmp (token, "string")) + typedata->base = BT_STRING; + else if (!strcmp (token, "_Decimal32")) + typedata->base = BT_DECIMAL32; + else if (!strcmp (token, "_Decimal64")) + typedata->base = BT_DECIMAL64; + else if (!strcmp (token, "_Decimal128")) + typedata->base = BT_DECIMAL128; + else if (!strcmp (token, "__ibm128")) + typedata->base = BT_IBM128; + else + { + (*diag) ("unrecognized base type at column %d\n", oldpos + 1); + return 0; + } + + handle_pointer (typedata); return 1; }