[PATCH v26 00/23] Optimize type traits compilation performance
Ken Matsui
kmatsui@gcc.gnu.org
Thu Dec 7 05:11:04 GMT 2023
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 patches for is_const, is_volatile, is_pointer, and
is_unbounded_array, which contain performance regression, from
this patch series since they are not ready for review yet.
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
--
2.43.0
More information about the Libstdc++
mailing list