From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 538EC395ACD3 for ; Thu, 17 Jun 2021 15:20:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 538EC395ACD3 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15HFK3ou014443; Thu, 17 Jun 2021 11:20:44 -0400 Received: from ppma05wdc.us.ibm.com (1b.90.2fa9.ip4.static.sl-reverse.com [169.47.144.27]) by mx0a-001b2d01.pphosted.com with ESMTP id 3988xqg0ba-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Jun 2021 11:20:43 -0400 Received: from pps.filterd (ppma05wdc.us.ibm.com [127.0.0.1]) by ppma05wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 15HFBRAX028888; Thu, 17 Jun 2021 15:20:43 GMT Received: from b03cxnp08025.gho.boulder.ibm.com (b03cxnp08025.gho.boulder.ibm.com [9.17.130.17]) by ppma05wdc.us.ibm.com with ESMTP id 3954gkndu7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Jun 2021 15:20:43 +0000 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 15HFKgu428770682 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Jun 2021 15:20:42 GMT Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 72FDF6E056; Thu, 17 Jun 2021 15:20:42 +0000 (GMT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5AC766E05D; Thu, 17 Jun 2021 15:20:42 +0000 (GMT) Received: from localhost (unknown [9.40.194.84]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP; Thu, 17 Jun 2021 15:20:42 +0000 (GMT) From: Bill Schmidt To: gcc-patches@gcc.gnu.org Cc: segher@kernel.crashing.org Subject: [PATCH 07/55] rs6000: Add functions for matching types, part 2 of 3 Date: Thu, 17 Jun 2021 10:18:51 -0500 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: X-TM-AS-GCONF: 00 X-Proofpoint-GUID: ACmUhjeCTQ8fz_0NGcZ8V4F4ha7hnwtl X-Proofpoint-ORIG-GUID: ACmUhjeCTQ8fz_0NGcZ8V4F4ha7hnwtl X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-06-17_13:2021-06-15, 2021-06-17 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 mlxlogscore=999 phishscore=0 priorityscore=1501 mlxscore=0 malwarescore=0 adultscore=0 impostorscore=0 clxscore=1015 spamscore=0 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106170096 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Jun 2021 15:20:45 -0000 2021-04-02 Bill Schmidt gcc/ * config/rs6000/rs6000-gen-builtins.c (match_basetype): Implement. --- 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; } -- 2.27.0