public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Alexandre Oliva <aoliva@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/users/aoliva/heads/testme)] strub: cope with identifier GCing
Date: Thu,  5 Oct 2023 05:33:34 +0000 (GMT)	[thread overview]
Message-ID: <20231005053334.0F1E43858CDB@sourceware.org> (raw)

https://gcc.gnu.org/g:f50b133c51be01d70b2db4e65b67d62ccbc806f6

commit f50b133c51be01d70b2db4e65b67d62ccbc806f6
Author: Alexandre Oliva <oliva@gnu.org>
Date:   Thu Oct 5 02:32:15 2023 -0300

    strub: cope with identifier GCing

Diff:
---
 gcc/ipa-strub.cc | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)

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"

             reply	other threads:[~2023-10-05  5:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-05  5:33 Alexandre Oliva [this message]
2023-10-05  5:37 Alexandre Oliva
2023-10-05  6:12 Alexandre Oliva
2023-10-05  6:15 Alexandre Oliva
2023-10-06  4:29 Alexandre Oliva
2023-10-06  4:33 Alexandre Oliva
2023-10-20  3:48 Alexandre Oliva

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231005053334.0F1E43858CDB@sourceware.org \
    --to=aoliva@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).