Message ID | 20231024020424.699427-1-kmatsui@gcc.gnu.org |
---|---|
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1667400vqx; Mon, 23 Oct 2023 19:05:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGcKKdxMXB4cC/OOgy7k75+rAsAWs+spW4LPR3CdvZAV9tO7h/F4tv8WCQEinz4DFxaKSoe X-Received: by 2002:a05:622a:253:b0:417:a2f9:bba6 with SMTP id c19-20020a05622a025300b00417a2f9bba6mr12435823qtx.60.1698113133690; Mon, 23 Oct 2023 19:05:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698113133; cv=pass; d=google.com; s=arc-20160816; b=E+8NEUGurYhugi7mjcglOfubVZg53GoMx/4GvEfBB/ux74/fNCGY2CkAX1xO1b0Ddw sD7R3qPZN8wLIk9AR4vUWIolkl+kllN3OozHnHf3qTVlBqxIuk7ywYI1PQGxt8n2qqwn HhlT6OGZGCLuRK8bXsq1QLL5tzhyQsoJBhVOfyO92lOkYr/UCRte8llK2IgLqV5PcSFv nwu8JL692Y9vxjvEMQU8N5g5LQIfaN4PvDLhl6SYwb7UKIr5T1mBGPT3efILniLJd5j2 y1Ug9eQctQd6dpI3niwzPj7ihknKvkqgkjHoChYQ4+N5g3z9kv/h4ahMBlDUgHkUsXsz qUmA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:arc-filter:dmarc-filter:delivered-to:dkim-signature :dkim-filter; bh=ttPBwmLP4bwTfVJIMpP0JbXdYpkqtPuEUZTjKmMJWLc=; fh=kSSy/oyUXqQD15FLeKdymIgDBFPFITPA1Gj52CNOxRQ=; b=AtTGtal2deG4ZmwIl6pmjgiSvA2zgBF74LeRih8JaSQzikBspF4KCr+n5bI3HCrQQv vFFYlBcVlCSFa/mPCCp4Xqd8qmL1TendgDCcZb+Tid6aYHkd1Eg2rmskdJaQ79Jtemf/ 0k9DIfAuz0bRcKfLu5xPe6R5zEfRkQBmX77BnC+2wUGdjkVGsaXLs19NmOS5m7b8rUcN yRpQZhOAbB5NPEyMfci9M+NKXF9xa8C8YhwysEFhZF4mY6YsmNtUJS21AsEej5fSG+ko 9GLRqI0uEWCbmS1yqjI1LmWF3PPUXOwharh8YznipvoUeI4E7XWzklVT79gY/2qGFD6e yHAQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Jnn3T7xx; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id d14-20020a05622a100e00b0041815b982a4si6300247qte.47.2023.10.23.19.05.33 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 19:05:33 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Jnn3T7xx; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6A7563857BB3 for <ouuuleilei@gmail.com>; Tue, 24 Oct 2023 02:05:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6A7563857BB3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1698113129; bh=ttPBwmLP4bwTfVJIMpP0JbXdYpkqtPuEUZTjKmMJWLc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Jnn3T7xxrMkVYiDa1s85vX6YKhUQxaL1QAKviL5I/3QnrCwZhJkkBMboOmuBSLkqO 4ntAbK+NBtHqccXNQMkwBdSugjE2xpecHQjWii/wxyYRRW0fujlLjEAEIGJIfhjee0 F0CdeIrjrt97RTcQK8x1wPghKe+ts3fUo320/eCM= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-00641c01.pphosted.com (mx0a-00641c01.pphosted.com [205.220.165.146]) by sourceware.org (Postfix) with ESMTPS id 243973858D37; Tue, 24 Oct 2023 02:04:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 243973858D37 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=gcc.gnu.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 243973858D37 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=205.220.165.146 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698113076; cv=none; b=gBqKQodrIcCDhkX9Zo4A9099NAwAWtmnpAb1fP2Vm1BdPf2mlGDwY1S1380N4eIgJInrU8t6mX5Gr+plIPAbRtWcfje5nWbsVCnCcyXkycmq3Rj8G14eB873frQ87ngZWYSPYFOQQQnELA9NVoJTuoUzQOl3IhK19GjOq8eo25I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698113076; c=relaxed/simple; bh=9UO12IBm/cPXegEnRPKsAuH5MUy9lUZLPm4b6arc2jg=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=wplWliUcUfCk41Ek51Zz6rW/RnKKdG1Y7i5+kZK2NaLkIq9cWyWB0e7Daoq8dZLvLiYVAuia57kLI7wk1Tz8z4XXbZc9BHkcQy7qFq4mnLlmJxAczsG3j/7gZpXib8d+jvXtBWwuNOoYMvdA9sgkr+QlfbsVopf1a4lmWyAd6lg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0247472.ppops.net [127.0.0.1]) by mx0a-00641c01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39O21BX0017650; Tue, 24 Oct 2023 02:04:34 GMT Received: from mxout21.s.uw.edu (mxout21.s.uw.edu [140.142.32.139]) by mx0a-00641c01.pphosted.com (PPS) with ESMTPS id 3twy7dtvta-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 Oct 2023 02:04:33 +0000 Received: from smtp.washington.edu (smtp.washington.edu [140.142.234.157]) by mxout21.s.uw.edu (8.14.4+UW20.07/8.14.4+UW22.04) with ESMTP id 39O24Una023558 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Oct 2023 19:04:30 -0700 X-Auth-Received: from kmatsui-ThinkPad-X1-Carbon-Gen-9.dhcp4.washington.edu ([10.19.18.191]) (authenticated authid=kmatsui) by smtp.washington.edu (8.16.1+UW21.10/8.14.4+UW19.10) with ESMTPSA id 39O24Tlw031305 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Oct 2023 19:04:29 -0700 X-UW-Orig-Sender: kmatsui@smtp.washington.edu From: Ken Matsui <kmatsui@gcc.gnu.org> To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Ken Matsui <kmatsui@gcc.gnu.org> Subject: [PATCH v25 00/33] Optimize type traits compilation performance Date: Mon, 23 Oct 2023 19:00:43 -0700 Message-ID: <20231024020424.699427-1-kmatsui@gcc.gnu.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231020162115.2307797-1-kmatsui@gcc.gnu.org> References: <20231020162115.2307797-1-kmatsui@gcc.gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-GUID: ZHUytEJRytTLVau5TFCasI6mjVxPbbZx X-Proofpoint-ORIG-GUID: ZHUytEJRytTLVau5TFCasI6mjVxPbbZx X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-24_01,2023-10-19_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxscore=0 priorityscore=1501 suspectscore=0 malwarescore=0 lowpriorityscore=0 spamscore=0 clxscore=1034 adultscore=0 bulkscore=0 mlxlogscore=811 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2310170001 definitions=main-2310240017 X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NEUTRAL, TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780600677590118998 X-GMAIL-MSGID: 1780600677590118998 |
Series |
Optimize type traits compilation performance
|
|
Message
Ken Matsui
Oct. 24, 2023, 2 a.m. UTC
This patch series optimizes type traits compilation performance by implementing built-in type traits and using them in libstdc++. Changes in v25: * Optimized the __is_pointer implementation in cpp_type_traits.h. * Fix compilation error in cpp_type_traits.h with Clang 16. * Wrapped commit messages at 75 columns. * Used & instead of && for the new IDENTIFIER_TRAIT_P macro. * Made cp_lexer_peek_trait not to take cp_token. * Fixed indentation error in cp_lexer_peek_trait. Changes in v24: * Fixed the way to handle an incomplete type error from __is_invocable in the test cases so that we can correctly test both the use of built-in and vice-versa. Changes in v23: * Improved the comment in cp-tree.h. * Moved the definition of cp_traits to lex.cc from parser.cc. * Implemented __is_invocable built-in trait. Changes in v22: * Included a missing patch in v21. Changes in v21: * Used _GLIBCXX_USE_BUILTIN_TRAIT instead of __has_builtin in cpp_type_traits.h. * Added const char* name to struct cp_trait, and loop over cp_traits in init_cp_traits to get the name. * Isolated patches for integral-related built-in traits from this patch series since they are not ready for review yet. * Implemented __is_object built-in trait. Changes in v20: * Used identifier node instead of gperf to look up built-in traits. Changes in v19: * Fixed a typo. * Rebased on top of trunk. * Improved clarity of the commit message. Changes in v18: * Removed all RID values for built-in traits and used cik_trait instead. * Improved to handle the use of non-function-like built-in trait identifiers. * Reverted all changes to conflicted identifiers with new built-ins in the existing code base. Changes in v17: * Rebased on top of trunk. * Improved clarity of the commit message. * Simplified Make-lang.in. * Made ridpointers for RID_TRAIT_EXPR and RID_TRAIT_TYPE empty. Changes in v16: * Rebased on top of trunk. * Improved clarity of the commit message. * Simplified Make-lang.in and gperf struct. * Supply -k option to gperf to support older versions than 2.8. Changes in v15: * Rebased on top of trunk. * Use gperf to look up traits instead of enum rid. Changes in v14: * Added padding calculation to the commit message. Changes in v13: * Fixed ambiguous commit message and comment. Changes in v12: * Evaluated all paddings affected by the enum rid change. Changes in v11: * Merged all patches into one patch series. * Rebased on top of trunk. * Unified commit message style. * Used _GLIBCXX_USE_BUILTIN_TRAIT. Ken Matsui (33): c++: Sort built-in traits alphabetically c-family, c++: Look up built-in traits via identifier node c++: Accept the use of built-in trait identifiers c++: Implement __is_const built-in trait libstdc++: Optimize std::is_const compilation performance c++: Implement __is_volatile built-in trait libstdc++: Optimize std::is_volatile compilation performance c++: Implement __is_array built-in trait libstdc++: Optimize std::is_array compilation performance c++: Implement __is_unbounded_array built-in trait libstdc++: Optimize std::is_unbounded_array compilation performance c++: Implement __is_bounded_array built-in trait libstdc++: Optimize std::is_bounded_array compilation performance c++: Implement __is_scoped_enum built-in trait libstdc++: Optimize std::is_scoped_enum compilation performance c++: Implement __is_member_pointer built-in trait libstdc++: Optimize std::is_member_pointer compilation performance c++: Implement __is_member_function_pointer built-in trait libstdc++: Optimize std::is_member_function_pointer compilation performance c++: Implement __is_member_object_pointer built-in trait libstdc++: Optimize std::is_member_object_pointer compilation performance c++: Implement __is_reference built-in trait libstdc++: Optimize std::is_reference compilation performance c++: Implement __is_function built-in trait libstdc++: Optimize std::is_function compilation performance c++: Implement __is_object built-in trait libstdc++: Optimize std::is_object compilation performance c++: Implement __remove_pointer built-in trait libstdc++: Optimize std::remove_pointer compilation performance c++: Implement __is_pointer built-in trait libstdc++: Optimize std::is_pointer compilation performance c++: Implement __is_invocable built-in trait libstdc++: Optimize std::is_invocable compilation performance gcc/c-family/c-common.cc | 7 - gcc/c-family/c-common.h | 5 - gcc/cp/constraint.cc | 109 ++++-- gcc/cp/cp-objcp-common.cc | 8 +- gcc/cp/cp-trait.def | 25 +- gcc/cp/cp-tree.h | 32 +- gcc/cp/lex.cc | 34 ++ gcc/cp/method.h | 28 ++ gcc/cp/parser.cc | 120 ++++--- gcc/cp/semantics.cc | 284 ++++++++++++--- gcc/testsuite/g++.dg/ext/has-builtin-1.C | 113 ++++-- gcc/testsuite/g++.dg/ext/is_array.C | 28 ++ gcc/testsuite/g++.dg/ext/is_bounded_array.C | 38 ++ gcc/testsuite/g++.dg/ext/is_const.C | 19 + gcc/testsuite/g++.dg/ext/is_function.C | 58 +++ gcc/testsuite/g++.dg/ext/is_invocable1.C | 337 ++++++++++++++++++ gcc/testsuite/g++.dg/ext/is_invocable2.C | 139 ++++++++ gcc/testsuite/g++.dg/ext/is_invocable3.C | 51 +++ gcc/testsuite/g++.dg/ext/is_invocable4.C | 33 ++ .../g++.dg/ext/is_member_function_pointer.C | 31 ++ .../g++.dg/ext/is_member_object_pointer.C | 30 ++ gcc/testsuite/g++.dg/ext/is_member_pointer.C | 30 ++ gcc/testsuite/g++.dg/ext/is_object.C | 29 ++ gcc/testsuite/g++.dg/ext/is_pointer.C | 51 +++ gcc/testsuite/g++.dg/ext/is_reference.C | 34 ++ gcc/testsuite/g++.dg/ext/is_scoped_enum.C | 67 ++++ gcc/testsuite/g++.dg/ext/is_unbounded_array.C | 37 ++ gcc/testsuite/g++.dg/ext/is_volatile.C | 19 + gcc/testsuite/g++.dg/ext/remove_pointer.C | 51 +++ libstdc++-v3/include/bits/cpp_type_traits.h | 29 ++ libstdc++-v3/include/std/type_traits | 219 +++++++++++- .../is_invocable/incomplete_args_neg.cc | 1 + .../20_util/is_invocable/incomplete_neg.cc | 1 + 33 files changed, 1901 insertions(+), 196 deletions(-) create mode 100644 gcc/cp/method.h create mode 100644 gcc/testsuite/g++.dg/ext/is_array.C create mode 100644 gcc/testsuite/g++.dg/ext/is_bounded_array.C create mode 100644 gcc/testsuite/g++.dg/ext/is_const.C create mode 100644 gcc/testsuite/g++.dg/ext/is_function.C create mode 100644 gcc/testsuite/g++.dg/ext/is_invocable1.C create mode 100644 gcc/testsuite/g++.dg/ext/is_invocable2.C create mode 100644 gcc/testsuite/g++.dg/ext/is_invocable3.C create mode 100644 gcc/testsuite/g++.dg/ext/is_invocable4.C create mode 100644 gcc/testsuite/g++.dg/ext/is_member_function_pointer.C create mode 100644 gcc/testsuite/g++.dg/ext/is_member_object_pointer.C create mode 100644 gcc/testsuite/g++.dg/ext/is_member_pointer.C create mode 100644 gcc/testsuite/g++.dg/ext/is_object.C create mode 100644 gcc/testsuite/g++.dg/ext/is_pointer.C create mode 100644 gcc/testsuite/g++.dg/ext/is_reference.C create mode 100644 gcc/testsuite/g++.dg/ext/is_scoped_enum.C create mode 100644 gcc/testsuite/g++.dg/ext/is_unbounded_array.C create mode 100644 gcc/testsuite/g++.dg/ext/is_volatile.C create mode 100644 gcc/testsuite/g++.dg/ext/remove_pointer.C
Comments
I accidentally sent is_invocable patches as well, but those have no changes. On Mon, Oct 23, 2023 at 7:04 PM Ken Matsui <kmatsui@gcc.gnu.org> wrote: > > This patch series optimizes type traits compilation performance by > implementing built-in type traits and using them in libstdc++. > > Changes in v25: > > * Optimized the __is_pointer implementation in cpp_type_traits.h. > * Fix compilation error in cpp_type_traits.h with Clang 16. > * Wrapped commit messages at 75 columns. > * Used & instead of && for the new IDENTIFIER_TRAIT_P macro. > * Made cp_lexer_peek_trait not to take cp_token. > * Fixed indentation error in cp_lexer_peek_trait. > > Changes in v24: > > * Fixed the way to handle an incomplete type error from __is_invocable > in the test cases so that we can correctly test both the use of > built-in and vice-versa. > > Changes in v23: > > * Improved the comment in cp-tree.h. > * Moved the definition of cp_traits to lex.cc from parser.cc. > * Implemented __is_invocable built-in trait. > > Changes in v22: > > * Included a missing patch in v21. > > Changes in v21: > > * Used _GLIBCXX_USE_BUILTIN_TRAIT instead of __has_builtin in > cpp_type_traits.h. > * Added const char* name to struct cp_trait, and loop over cp_traits > in init_cp_traits to get the name. > * Isolated patches for integral-related built-in traits from > this patch series since they are not ready for review yet. > * Implemented __is_object built-in trait. > > Changes in v20: > > * Used identifier node instead of gperf to look up built-in > traits. > > Changes in v19: > > * Fixed a typo. > * Rebased on top of trunk. > * Improved clarity of the commit message. > > Changes in v18: > > * Removed all RID values for built-in traits and used cik_trait > instead. > * Improved to handle the use of non-function-like built-in trait > identifiers. > * Reverted all changes to conflicted identifiers with new built-ins > in the existing code base. > > Changes in v17: > > * Rebased on top of trunk. > * Improved clarity of the commit message. > * Simplified Make-lang.in. > * Made ridpointers for RID_TRAIT_EXPR and RID_TRAIT_TYPE empty. > > Changes in v16: > > * Rebased on top of trunk. > * Improved clarity of the commit message. > * Simplified Make-lang.in and gperf struct. > * Supply -k option to gperf to support older versions than 2.8. > > Changes in v15: > > * Rebased on top of trunk. > * Use gperf to look up traits instead of enum rid. > > Changes in v14: > > * Added padding calculation to the commit message. > > Changes in v13: > > * Fixed ambiguous commit message and comment. > > Changes in v12: > > * Evaluated all paddings affected by the enum rid change. > > Changes in v11: > > * Merged all patches into one patch series. > * Rebased on top of trunk. > * Unified commit message style. > * Used _GLIBCXX_USE_BUILTIN_TRAIT. > > Ken Matsui (33): > c++: Sort built-in traits alphabetically > c-family, c++: Look up built-in traits via identifier node > c++: Accept the use of built-in trait identifiers > c++: Implement __is_const built-in trait > libstdc++: Optimize std::is_const compilation performance > c++: Implement __is_volatile built-in trait > libstdc++: Optimize std::is_volatile compilation performance > c++: Implement __is_array built-in trait > libstdc++: Optimize std::is_array compilation performance > c++: Implement __is_unbounded_array built-in trait > libstdc++: Optimize std::is_unbounded_array compilation performance > c++: Implement __is_bounded_array built-in trait > libstdc++: Optimize std::is_bounded_array compilation performance > c++: Implement __is_scoped_enum built-in trait > libstdc++: Optimize std::is_scoped_enum compilation performance > c++: Implement __is_member_pointer built-in trait > libstdc++: Optimize std::is_member_pointer compilation performance > c++: Implement __is_member_function_pointer built-in trait > libstdc++: Optimize std::is_member_function_pointer compilation > performance > c++: Implement __is_member_object_pointer built-in trait > libstdc++: Optimize std::is_member_object_pointer compilation > performance > c++: Implement __is_reference built-in trait > libstdc++: Optimize std::is_reference compilation performance > c++: Implement __is_function built-in trait > libstdc++: Optimize std::is_function compilation performance > c++: Implement __is_object built-in trait > libstdc++: Optimize std::is_object compilation performance > c++: Implement __remove_pointer built-in trait > libstdc++: Optimize std::remove_pointer compilation performance > c++: Implement __is_pointer built-in trait > libstdc++: Optimize std::is_pointer compilation performance > c++: Implement __is_invocable built-in trait > libstdc++: Optimize std::is_invocable compilation performance > > gcc/c-family/c-common.cc | 7 - > gcc/c-family/c-common.h | 5 - > gcc/cp/constraint.cc | 109 ++++-- > gcc/cp/cp-objcp-common.cc | 8 +- > gcc/cp/cp-trait.def | 25 +- > gcc/cp/cp-tree.h | 32 +- > gcc/cp/lex.cc | 34 ++ > gcc/cp/method.h | 28 ++ > gcc/cp/parser.cc | 120 ++++--- > gcc/cp/semantics.cc | 284 ++++++++++++--- > gcc/testsuite/g++.dg/ext/has-builtin-1.C | 113 ++++-- > gcc/testsuite/g++.dg/ext/is_array.C | 28 ++ > gcc/testsuite/g++.dg/ext/is_bounded_array.C | 38 ++ > gcc/testsuite/g++.dg/ext/is_const.C | 19 + > gcc/testsuite/g++.dg/ext/is_function.C | 58 +++ > gcc/testsuite/g++.dg/ext/is_invocable1.C | 337 ++++++++++++++++++ > gcc/testsuite/g++.dg/ext/is_invocable2.C | 139 ++++++++ > gcc/testsuite/g++.dg/ext/is_invocable3.C | 51 +++ > gcc/testsuite/g++.dg/ext/is_invocable4.C | 33 ++ > .../g++.dg/ext/is_member_function_pointer.C | 31 ++ > .../g++.dg/ext/is_member_object_pointer.C | 30 ++ > gcc/testsuite/g++.dg/ext/is_member_pointer.C | 30 ++ > gcc/testsuite/g++.dg/ext/is_object.C | 29 ++ > gcc/testsuite/g++.dg/ext/is_pointer.C | 51 +++ > gcc/testsuite/g++.dg/ext/is_reference.C | 34 ++ > gcc/testsuite/g++.dg/ext/is_scoped_enum.C | 67 ++++ > gcc/testsuite/g++.dg/ext/is_unbounded_array.C | 37 ++ > gcc/testsuite/g++.dg/ext/is_volatile.C | 19 + > gcc/testsuite/g++.dg/ext/remove_pointer.C | 51 +++ > libstdc++-v3/include/bits/cpp_type_traits.h | 29 ++ > libstdc++-v3/include/std/type_traits | 219 +++++++++++- > .../is_invocable/incomplete_args_neg.cc | 1 + > .../20_util/is_invocable/incomplete_neg.cc | 1 + > 33 files changed, 1901 insertions(+), 196 deletions(-) > create mode 100644 gcc/cp/method.h > create mode 100644 gcc/testsuite/g++.dg/ext/is_array.C > create mode 100644 gcc/testsuite/g++.dg/ext/is_bounded_array.C > create mode 100644 gcc/testsuite/g++.dg/ext/is_const.C > create mode 100644 gcc/testsuite/g++.dg/ext/is_function.C > create mode 100644 gcc/testsuite/g++.dg/ext/is_invocable1.C > create mode 100644 gcc/testsuite/g++.dg/ext/is_invocable2.C > create mode 100644 gcc/testsuite/g++.dg/ext/is_invocable3.C > create mode 100644 gcc/testsuite/g++.dg/ext/is_invocable4.C > create mode 100644 gcc/testsuite/g++.dg/ext/is_member_function_pointer.C > create mode 100644 gcc/testsuite/g++.dg/ext/is_member_object_pointer.C > create mode 100644 gcc/testsuite/g++.dg/ext/is_member_pointer.C > create mode 100644 gcc/testsuite/g++.dg/ext/is_object.C > create mode 100644 gcc/testsuite/g++.dg/ext/is_pointer.C > create mode 100644 gcc/testsuite/g++.dg/ext/is_reference.C > create mode 100644 gcc/testsuite/g++.dg/ext/is_scoped_enum.C > create mode 100644 gcc/testsuite/g++.dg/ext/is_unbounded_array.C > create mode 100644 gcc/testsuite/g++.dg/ext/is_volatile.C > create mode 100644 gcc/testsuite/g++.dg/ext/remove_pointer.C > > -- > 2.42.0 >
This patch series optimizes type traits compilation performance by implementing built-in type traits and using them in libstdc++. Changes in v26: * Rebased on top of trunk. * Moved is_function_v under is_const_v. * Isolated is_const, is_volatile, is_pointer, and is_unbounded_array patches, which contain performance regression, from this patch series. Changes in v25: * Optimized the __is_pointer implementation in cpp_type_traits.h. * Fix compilation error in cpp_type_traits.h with Clang 16. * Wrapped commit messages at 75 columns. * Used & instead of && for the new IDENTIFIER_TRAIT_P macro. * Made cp_lexer_peek_trait not to take cp_token. * Fixed indentation error in cp_lexer_peek_trait. Changes in v24: * Fixed the way to handle an incomplete type error from __is_invocable in the test cases so that we can correctly test both the use of built-in and vice-versa. Changes in v23: * Improved the comment in cp-tree.h. * Moved the definition of cp_traits to lex.cc from parser.cc. * Implemented __is_invocable built-in trait. Changes in v22: * Included a missing patch in v21. Changes in v21: * Used _GLIBCXX_USE_BUILTIN_TRAIT instead of __has_builtin in cpp_type_traits.h. * Added const char* name to struct cp_trait, and loop over cp_traits in init_cp_traits to get the name. * Isolated patches for integral-related built-in traits from this patch series since they are not ready for review yet. * Implemented __is_object built-in trait. Changes in v20: * Used identifier node instead of gperf to look up built-in traits. Changes in v19: * Fixed a typo. * Rebased on top of trunk. * Improved clarity of the commit message. Changes in v18: * Removed all RID values for built-in traits and used cik_trait instead. * Improved to handle the use of non-function-like built-in trait identifiers. * Reverted all changes to conflicted identifiers with new built-ins in the existing code base. Changes in v17: * Rebased on top of trunk. * Improved clarity of the commit message. * Simplified Make-lang.in. * Made ridpointers for RID_TRAIT_EXPR and RID_TRAIT_TYPE empty. Changes in v16: * Rebased on top of trunk. * Improved clarity of the commit message. * Simplified Make-lang.in and gperf struct. * Supply -k option to gperf to support older versions than 2.8. Changes in v15: * Rebased on top of trunk. * Use gperf to look up traits instead of enum rid. Changes in v14: * Added padding calculation to the commit message. Changes in v13: * Fixed ambiguous commit message and comment. Changes in v12: * Evaluated all paddings affected by the enum rid change. Changes in v11: * Merged all patches into one patch series. * Rebased on top of trunk. * Unified commit message style. * Used _GLIBCXX_USE_BUILTIN_TRAIT. Ken Matsui (23): c++: Sort built-in traits alphabetically c-family, c++: Look up built-in traits via identifier node c++: Accept the use of built-in trait identifiers c++: Implement __is_array built-in trait libstdc++: Optimize std::is_array compilation performance c++: Implement __is_bounded_array built-in trait libstdc++: Optimize std::is_bounded_array compilation performance c++: Implement __is_scoped_enum built-in trait libstdc++: Optimize std::is_scoped_enum compilation performance c++: Implement __is_member_pointer built-in trait libstdc++: Optimize std::is_member_pointer compilation performance c++: Implement __is_member_function_pointer built-in trait libstdc++: Optimize std::is_member_function_pointer compilation performance c++: Implement __is_member_object_pointer built-in trait libstdc++: Optimize std::is_member_object_pointer compilation performance c++: Implement __is_reference built-in trait libstdc++: Optimize std::is_reference compilation performance c++: Implement __is_function built-in trait libstdc++: Optimize std::is_function compilation performance c++: Implement __is_object built-in trait libstdc++: Optimize std::is_object compilation performance c++: Implement __remove_pointer built-in trait libstdc++: Optimize std::remove_pointer compilation performance gcc/c-family/c-common.cc | 7 - gcc/c-family/c-common.h | 5 - gcc/cp/constraint.cc | 95 +++++++----- gcc/cp/cp-objcp-common.cc | 8 +- gcc/cp/cp-trait.def | 20 ++- gcc/cp/cp-tree.h | 32 +++-- gcc/cp/lex.cc | 34 +++++ gcc/cp/parser.cc | 120 ++++++++++------ gcc/cp/semantics.cc | 135 ++++++++++++------ gcc/testsuite/g++.dg/ext/has-builtin-1.C | 100 ++++++++----- gcc/testsuite/g++.dg/ext/is_array.C | 28 ++++ gcc/testsuite/g++.dg/ext/is_bounded_array.C | 38 +++++ gcc/testsuite/g++.dg/ext/is_function.C | 58 ++++++++ .../g++.dg/ext/is_member_function_pointer.C | 31 ++++ .../g++.dg/ext/is_member_object_pointer.C | 30 ++++ gcc/testsuite/g++.dg/ext/is_member_pointer.C | 30 ++++ gcc/testsuite/g++.dg/ext/is_object.C | 29 ++++ gcc/testsuite/g++.dg/ext/is_reference.C | 34 +++++ gcc/testsuite/g++.dg/ext/is_scoped_enum.C | 67 +++++++++ gcc/testsuite/g++.dg/ext/remove_pointer.C | 51 +++++++ libstdc++-v3/include/std/type_traits | 135 +++++++++++++++++- 21 files changed, 898 insertions(+), 189 deletions(-) create mode 100644 gcc/testsuite/g++.dg/ext/is_array.C create mode 100644 gcc/testsuite/g++.dg/ext/is_bounded_array.C create mode 100644 gcc/testsuite/g++.dg/ext/is_function.C create mode 100644 gcc/testsuite/g++.dg/ext/is_member_function_pointer.C create mode 100644 gcc/testsuite/g++.dg/ext/is_member_object_pointer.C create mode 100644 gcc/testsuite/g++.dg/ext/is_member_pointer.C create mode 100644 gcc/testsuite/g++.dg/ext/is_object.C create mode 100644 gcc/testsuite/g++.dg/ext/is_reference.C create mode 100644 gcc/testsuite/g++.dg/ext/is_scoped_enum.C create mode 100644 gcc/testsuite/g++.dg/ext/remove_pointer.C