From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2140) id A73393857716; Thu, 5 Oct 2023 05:37:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A73393857716 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1696484278; bh=dXN49p/DyTyFza2UMs8u2GBRte5zVg25VlRk4+n2LUE=; h=From:To:Subject:Date:From; b=pe0nLmUICdYIXoVfy7X0Z4wSUnEN0CJeTADcsMFptC0f6YEg8Zgd3LKEblW3MbXcK 1NcFA/3w/G1eOlteOiS44o/sPYKuVY3NsbM1hGx9HK/pjRt7oiOYcOgP7nTpTx5YP1 30EZouGFlQZyznTDS0i2sjhq4syxmZPXy/xiG5PU= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Alexandre Oliva To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/aoliva/heads/testme)] strub: cope with identifier GCing X-Act-Checkin: gcc X-Git-Author: Alexandre Oliva X-Git-Refname: refs/users/aoliva/heads/testme X-Git-Oldrev: 1d4e505ea6a19c86cff497e03ad5e9a100a2a404 X-Git-Newrev: 83219fa94674544803ab599ab728b0628fa700ed Message-Id: <20231005053758.A73393857716@sourceware.org> Date: Thu, 5 Oct 2023 05:37:58 +0000 (GMT) List-Id: https://gcc.gnu.org/g:83219fa94674544803ab599ab728b0628fa700ed commit 83219fa94674544803ab599ab728b0628fa700ed Author: Alexandre Oliva Date: Thu Oct 5 02:32:15 2023 -0300 strub: cope with identifier GCing Diff: --- gcc/Makefile.in | 1 + gcc/ipa-strub.cc | 31 ++++++++++++++++++------------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 93b7ff2a502..987a6a769ec 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -2846,6 +2846,7 @@ GTFILES = $(CPPLIB_H) $(srcdir)/input.h $(srcdir)/coretypes.h \ $(srcdir)/sanopt.cc \ $(srcdir)/sancov.cc \ $(srcdir)/ipa-devirt.cc \ + $(srcdir)/ipa-strub.cc \ $(srcdir)/internal-fn.h \ $(srcdir)/calls.cc \ $(srcdir)/omp-general.h \ diff --git a/gcc/ipa-strub.cc b/gcc/ipa-strub.cc index 861cd0cffa0..fd83079f6a9 100644 --- a/gcc/ipa-strub.cc +++ b/gcc/ipa-strub.cc @@ -170,29 +170,32 @@ get_strub_attr_from_decl (tree decl) return get_strub_attr_from_type (TREE_TYPE (decl)); } +/* Keep the strub mode identifiers from being GC'd. */ +static tree GTY(()) strub_ids[8]; + /* Define a function to cache identifier ID, to be used as a strub attribute parameter for a strub mode named after NAME. */ -#define DEF_STRUB_IDS(NAME, ID) \ +#define DEF_STRUB_IDS(IDX, NAME, ID) \ static inline tree get_strub_mode_id_ ## NAME () { \ - static tree identifier = NULL_TREE; \ + tree identifier = strub_ids[IDX]; \ if (!identifier) \ - identifier = get_identifier (ID); \ + strub_ids[IDX] = identifier = get_identifier (ID); \ return identifier; \ } /* Same as DEF_STRUB_IDS, but use the string expansion of NAME as ID. */ -#define DEF_STRUB_ID(NAME) \ -DEF_STRUB_IDS (NAME, #NAME) +#define DEF_STRUB_ID(IDX, NAME) \ + DEF_STRUB_IDS (IDX, NAME, #NAME) /* Define functions for each of the strub mode identifiers. Expose dashes rather than underscores. */ -DEF_STRUB_ID (disabled) -DEF_STRUB_IDS (at_calls, "at-calls") -DEF_STRUB_ID (internal) -DEF_STRUB_ID (callable) -DEF_STRUB_ID (wrapped) -DEF_STRUB_ID (wrapper) -DEF_STRUB_ID (inlinable) -DEF_STRUB_IDS (at_calls_opt, "at-calls-opt") +DEF_STRUB_ID (0, disabled) +DEF_STRUB_IDS (1, at_calls, "at-calls") +DEF_STRUB_ID (2, internal) +DEF_STRUB_ID (3, callable) +DEF_STRUB_ID (4, wrapped) +DEF_STRUB_ID (5, wrapper) +DEF_STRUB_ID (6, inlinable) +DEF_STRUB_IDS (7, at_calls_opt, "at-calls-opt") /* Release the temporary macro names. */ #undef DEF_STRUB_IDS @@ -3452,3 +3455,5 @@ make_pass_ipa_strub (gcc::context *ctxt) { return new pass_ipa_strub (ctxt); } + +#include "gt-ipa-strub.h"