diff options
author | Patrick Palka <ppalka@redhat.com> | 2023-09-20 12:07:15 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2023-09-20 12:07:15 -0400 |
commit | 915574e538322aad5195bc3b6be2a4f85bbd2467 (patch) | |
tree | 23dff84f3051ac24ab4b3c1c5618895e6f74fe8d /libgcc/enable-execute-stack-empty.c | |
parent | 1a554a2c9f33fdb3c170f1c37274037ece050114 (diff) | |
download | gcc-915574e538322aad5195bc3b6be2a4f85bbd2467.zip gcc-915574e538322aad5195bc3b6be2a4f85bbd2467.tar.gz gcc-915574e538322aad5195bc3b6be2a4f85bbd2467.tar.bz2 |
c++: further optimize tsubst_template_decl
This patch makes tsubst_template_decl use use_spec_table=false also in
the non-class non-function template case, to avoid computing 'argvec' and
doing a hash table lookup from tsubst_decl (when partially instantiating
a member variable/alias template).
This change reveals that for function templates, tsubst_template_decl
registers the partially instantiated TEMPLATE_DECL, whereas for other
non-class templates it registers the corresponding DECL_TEMPLATE_RESULT
which is an interesting inconsistency that I decided to preserve for now.
Trying to consistently register the TEMPLATE_DECL (or DECL_TEMPLATE_RESULT)
causes modules ICEs which I didn't look into.
In passing, in tsubst_function_decl I noticed 'argvec' is unused
when 'lambda_fntype' is set (since lambdas aren't recorded in the
specializations table), so we can avoid computing it in that case.
gcc/cp/ChangeLog:
* pt.cc (tsubst_function_decl): Don't bother computing 'argvec'
when 'lambda_fntype' is set.
(tsubst_template_decl): Make sure we return a TEMPLATE_DECL
during specialization lookup. In the non-class non-function
template case, use tsubst_decl directly with use_spec_table=false,
update DECL_TI_ARGS and call register_specialization like
tsubst_decl would have done if use_spec_table=true.
Diffstat (limited to 'libgcc/enable-execute-stack-empty.c')
0 files changed, 0 insertions, 0 deletions