public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/aoliva/heads/testme)] strub: cope with identifier GCing
@ 2023-10-20 3:48 Alexandre Oliva
0 siblings, 0 replies; 7+ messages in thread
From: Alexandre Oliva @ 2023-10-20 3:48 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:ef1aa619628f218e998d67eeb0b7c9b79dcdb953
commit ef1aa619628f218e998d67eeb0b7c9b79dcdb953
Author: Alexandre Oliva <oliva@gnu.org>
Date: Thu Oct 19 02:53:15 2023 -0300
strub: cope with identifier GCing
Diff:
---
gcc/Makefile.in | 1 +
gcc/gengtype-lex.l | 3 ++
gcc/ipa-strub.cc | 83 ++++++++++++++++++++++++++++++++----------------------
3 files changed, 54 insertions(+), 33 deletions(-)
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index e068ce91a946..53e953e22434 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -2847,6 +2847,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/gengtype-lex.l b/gcc/gengtype-lex.l
index 34837d9dc9a8..a7bb44cf2b9a 100644
--- a/gcc/gengtype-lex.l
+++ b/gcc/gengtype-lex.l
@@ -165,6 +165,9 @@ CXX_KEYWORD inline|public:|private:|protected:|template|operator|friend|static|m
[(){},*:<>;=%/|+\!\?\.-] { return yytext[0]; }
/* ignore pp-directives */
+^{HWS}"#"{HWS}[a-z_]+([^\n]*"\\"\n)+[^\n]*\n {
+ update_lineno (yytext, yyleng);
+}
^{HWS}"#"{HWS}[a-z_]+[^\n]*\n {lexer_line.line++;}
. {
diff --git a/gcc/ipa-strub.cc b/gcc/ipa-strub.cc
index 876828ad4317..f3b2473b5939 100644
--- a/gcc/ipa-strub.cc
+++ b/gcc/ipa-strub.cc
@@ -170,29 +170,42 @@ get_strub_attr_from_decl (tree decl)
return get_strub_attr_from_type (TREE_TYPE (decl));
}
+#define STRUB_ID_COUNT 8
+#define STRUB_IDENT_COUNT 3
+#define STRUB_TYPE_COUNT 5
+
+#define STRUB_ID_BASE 0
+#define STRUB_IDENT_BASE (STRUB_ID_BASE + STRUB_ID_COUNT)
+#define STRUB_TYPE_BASE (STRUB_IDENT_BASE + STRUB_IDENT_COUNT)
+#define STRUB_CACHE_SIZE (STRUB_TYPE_BASE + STRUB_TYPE_COUNT)
+
+/* Keep the strub mode and temp identifiers and types from being GC'd. */
+static GTY((deletable)) tree strub_cache[STRUB_CACHE_SIZE];
+
/* 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) \
-static inline tree get_strub_mode_id_ ## NAME () { \
- static tree identifier = NULL_TREE; \
- if (!identifier) \
- identifier = get_identifier (ID); \
- return identifier; \
+#define DEF_STRUB_IDS(IDX, NAME, ID) \
+static inline tree get_strub_mode_id_ ## NAME () { \
+ int idx = STRUB_ID_BASE + IDX; \
+ tree identifier = strub_cache[idx]; \
+ if (!identifier) \
+ strub_cache[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
@@ -1604,31 +1617,32 @@ public:
virtual unsigned int execute (function *);
/* Define on demand and cache some types we use often. */
-#define DEF_TYPE(NAME, INIT) \
+#define DEF_TYPE(IDX, NAME, INIT) \
static inline tree get_ ## NAME () { \
- static tree type = NULL_TREE; \
+ int idx = STRUB_TYPE_BASE + IDX; \
+ static tree type = strub_cache[idx]; \
if (!type) \
- type = (INIT); \
+ strub_cache[idx] = type = (INIT); \
return type; \
}
/* Use a distinct ptr_type_node to denote the watermark, so that we can
recognize it in arg lists and avoid modifying types twice. */
- DEF_TYPE (wmt, build_variant_type_copy (ptr_type_node))
+ DEF_TYPE (0, wmt, build_variant_type_copy (ptr_type_node))
- DEF_TYPE (pwmt, build_reference_type (get_wmt ()))
+ DEF_TYPE (1, pwmt, build_reference_type (get_wmt ()))
- DEF_TYPE (qpwmt,
+ DEF_TYPE (2, qpwmt,
build_qualified_type (get_pwmt (),
TYPE_QUAL_RESTRICT
/* | TYPE_QUAL_CONST */))
- DEF_TYPE (qptr,
+ DEF_TYPE (3, qptr,
build_qualified_type (ptr_type_node,
TYPE_QUAL_RESTRICT
| TYPE_QUAL_CONST))
- DEF_TYPE (qpvalst,
+ DEF_TYPE (4, qpvalst,
build_qualified_type (build_reference_type
(va_list_type_node),
TYPE_QUAL_RESTRICT
@@ -1697,17 +1711,18 @@ public:
#undef DEF_SS_BUILTIN
/* Define strub identifiers on demand. */
-#define DEF_IDENT(NAME) \
- static inline tree get_ ## NAME () { \
- static tree identifier = NULL_TREE; \
- if (!identifier) \
- identifier = get_identifier (".strub." #NAME); \
- return identifier; \
+#define DEF_IDENT(IDX, NAME) \
+ static inline tree get_ ## NAME () { \
+ int idx = STRUB_IDENT_BASE + IDX; \
+ tree identifier = strub_cache[idx]; \
+ if (!identifier) \
+ strub_cache[idx] = identifier = get_identifier (".strub." #NAME); \
+ return identifier; \
}
- DEF_IDENT (watermark_ptr)
- DEF_IDENT (va_list_ptr)
- DEF_IDENT (apply_args)
+ DEF_IDENT (0, watermark_ptr)
+ DEF_IDENT (1, va_list_ptr)
+ DEF_IDENT (2, apply_args)
#undef DEF_IDENT
@@ -3432,3 +3447,5 @@ make_pass_ipa_strub (gcc::context *ctxt)
{
return new pass_ipa_strub (ctxt);
}
+
+#include "gt-ipa-strub.h"
^ permalink raw reply [flat|nested] 7+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] strub: cope with identifier GCing
@ 2023-10-06 4:33 Alexandre Oliva
0 siblings, 0 replies; 7+ messages in thread
From: Alexandre Oliva @ 2023-10-06 4:33 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:dbe7ecc8e8b25d877765396ed75578e3a53cd684
commit dbe7ecc8e8b25d877765396ed75578e3a53cd684
Author: Alexandre Oliva <oliva@gnu.org>
Date: Thu Oct 5 02:32:15 2023 -0300
strub: cope with identifier GCing
Diff:
---
gcc/Makefile.in | 1 +
gcc/gengtype-lex.l | 3 ++
gcc/ipa-strub.cc | 83 ++++++++++++++++++++++++++++++++----------------------
3 files changed, 54 insertions(+), 33 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/gengtype-lex.l b/gcc/gengtype-lex.l
index 34837d9dc9a..a7bb44cf2b9 100644
--- a/gcc/gengtype-lex.l
+++ b/gcc/gengtype-lex.l
@@ -165,6 +165,9 @@ CXX_KEYWORD inline|public:|private:|protected:|template|operator|friend|static|m
[(){},*:<>;=%/|+\!\?\.-] { return yytext[0]; }
/* ignore pp-directives */
+^{HWS}"#"{HWS}[a-z_]+([^\n]*"\\"\n)+[^\n]*\n {
+ update_lineno (yytext, yyleng);
+}
^{HWS}"#"{HWS}[a-z_]+[^\n]*\n {lexer_line.line++;}
. {
diff --git a/gcc/ipa-strub.cc b/gcc/ipa-strub.cc
index 876828ad431..f3b2473b593 100644
--- a/gcc/ipa-strub.cc
+++ b/gcc/ipa-strub.cc
@@ -170,29 +170,42 @@ get_strub_attr_from_decl (tree decl)
return get_strub_attr_from_type (TREE_TYPE (decl));
}
+#define STRUB_ID_COUNT 8
+#define STRUB_IDENT_COUNT 3
+#define STRUB_TYPE_COUNT 5
+
+#define STRUB_ID_BASE 0
+#define STRUB_IDENT_BASE (STRUB_ID_BASE + STRUB_ID_COUNT)
+#define STRUB_TYPE_BASE (STRUB_IDENT_BASE + STRUB_IDENT_COUNT)
+#define STRUB_CACHE_SIZE (STRUB_TYPE_BASE + STRUB_TYPE_COUNT)
+
+/* Keep the strub mode and temp identifiers and types from being GC'd. */
+static GTY((deletable)) tree strub_cache[STRUB_CACHE_SIZE];
+
/* 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) \
-static inline tree get_strub_mode_id_ ## NAME () { \
- static tree identifier = NULL_TREE; \
- if (!identifier) \
- identifier = get_identifier (ID); \
- return identifier; \
+#define DEF_STRUB_IDS(IDX, NAME, ID) \
+static inline tree get_strub_mode_id_ ## NAME () { \
+ int idx = STRUB_ID_BASE + IDX; \
+ tree identifier = strub_cache[idx]; \
+ if (!identifier) \
+ strub_cache[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
@@ -1604,31 +1617,32 @@ public:
virtual unsigned int execute (function *);
/* Define on demand and cache some types we use often. */
-#define DEF_TYPE(NAME, INIT) \
+#define DEF_TYPE(IDX, NAME, INIT) \
static inline tree get_ ## NAME () { \
- static tree type = NULL_TREE; \
+ int idx = STRUB_TYPE_BASE + IDX; \
+ static tree type = strub_cache[idx]; \
if (!type) \
- type = (INIT); \
+ strub_cache[idx] = type = (INIT); \
return type; \
}
/* Use a distinct ptr_type_node to denote the watermark, so that we can
recognize it in arg lists and avoid modifying types twice. */
- DEF_TYPE (wmt, build_variant_type_copy (ptr_type_node))
+ DEF_TYPE (0, wmt, build_variant_type_copy (ptr_type_node))
- DEF_TYPE (pwmt, build_reference_type (get_wmt ()))
+ DEF_TYPE (1, pwmt, build_reference_type (get_wmt ()))
- DEF_TYPE (qpwmt,
+ DEF_TYPE (2, qpwmt,
build_qualified_type (get_pwmt (),
TYPE_QUAL_RESTRICT
/* | TYPE_QUAL_CONST */))
- DEF_TYPE (qptr,
+ DEF_TYPE (3, qptr,
build_qualified_type (ptr_type_node,
TYPE_QUAL_RESTRICT
| TYPE_QUAL_CONST))
- DEF_TYPE (qpvalst,
+ DEF_TYPE (4, qpvalst,
build_qualified_type (build_reference_type
(va_list_type_node),
TYPE_QUAL_RESTRICT
@@ -1697,17 +1711,18 @@ public:
#undef DEF_SS_BUILTIN
/* Define strub identifiers on demand. */
-#define DEF_IDENT(NAME) \
- static inline tree get_ ## NAME () { \
- static tree identifier = NULL_TREE; \
- if (!identifier) \
- identifier = get_identifier (".strub." #NAME); \
- return identifier; \
+#define DEF_IDENT(IDX, NAME) \
+ static inline tree get_ ## NAME () { \
+ int idx = STRUB_IDENT_BASE + IDX; \
+ tree identifier = strub_cache[idx]; \
+ if (!identifier) \
+ strub_cache[idx] = identifier = get_identifier (".strub." #NAME); \
+ return identifier; \
}
- DEF_IDENT (watermark_ptr)
- DEF_IDENT (va_list_ptr)
- DEF_IDENT (apply_args)
+ DEF_IDENT (0, watermark_ptr)
+ DEF_IDENT (1, va_list_ptr)
+ DEF_IDENT (2, apply_args)
#undef DEF_IDENT
@@ -3432,3 +3447,5 @@ make_pass_ipa_strub (gcc::context *ctxt)
{
return new pass_ipa_strub (ctxt);
}
+
+#include "gt-ipa-strub.h"
^ permalink raw reply [flat|nested] 7+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] strub: cope with identifier GCing
@ 2023-10-06 4:29 Alexandre Oliva
0 siblings, 0 replies; 7+ messages in thread
From: Alexandre Oliva @ 2023-10-06 4:29 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:da51e038ca5ba86c0d33170f7eb18beabe495456
commit da51e038ca5ba86c0d33170f7eb18beabe495456
Author: Alexandre Oliva <oliva@gnu.org>
Date: Thu Oct 5 02:32:15 2023 -0300
strub: cope with identifier GCing
Diff:
---
gcc/Makefile.in | 1 +
gcc/gengtype-lex.l | 3 ++
gcc/ipa-strub.cc | 83 ++++++++++++++++++++++++++++++++----------------------
3 files changed, 54 insertions(+), 33 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/gengtype-lex.l b/gcc/gengtype-lex.l
index 34837d9dc9a..a7bb44cf2b9 100644
--- a/gcc/gengtype-lex.l
+++ b/gcc/gengtype-lex.l
@@ -165,6 +165,9 @@ CXX_KEYWORD inline|public:|private:|protected:|template|operator|friend|static|m
[(){},*:<>;=%/|+\!\?\.-] { return yytext[0]; }
/* ignore pp-directives */
+^{HWS}"#"{HWS}[a-z_]+([^\n]*"\\"\n)+[^\n]*\n {
+ update_lineno (yytext, yyleng);
+}
^{HWS}"#"{HWS}[a-z_]+[^\n]*\n {lexer_line.line++;}
. {
diff --git a/gcc/ipa-strub.cc b/gcc/ipa-strub.cc
index 876828ad431..67de14adcd1 100644
--- a/gcc/ipa-strub.cc
+++ b/gcc/ipa-strub.cc
@@ -170,29 +170,42 @@ get_strub_attr_from_decl (tree decl)
return get_strub_attr_from_type (TREE_TYPE (decl));
}
+#define STRUB_ID_COUNT 8
+#define STRUB_IDENT_COUNT 3
+#define STRUB_TYPE_COUNT 5
+
+#define STRUB_ID_BASE 0
+#define STRUB_IDENT_BASE (STRUB_ID_BASE + STRUB_ID_COUNT)
+#define STRUB_TYPE_BASE (STRUB_IDENT_BASE + STRUB_IDENT_COUNT)
+#define STRUB_CACHE_SIZE (STRUB_TYPE_BASE + STRUB_TYPE_COUNT)
+
+/* Keep the strub mode and temp identifiers and types from being GC'd. */
+static GTY((cache)) tree strub_cache[STRUB_CACHE_SIZE];
+
/* 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) \
-static inline tree get_strub_mode_id_ ## NAME () { \
- static tree identifier = NULL_TREE; \
- if (!identifier) \
- identifier = get_identifier (ID); \
- return identifier; \
+#define DEF_STRUB_IDS(IDX, NAME, ID) \
+static inline tree get_strub_mode_id_ ## NAME () { \
+ int idx = STRUB_ID_BASE + IDX; \
+ tree identifier = strub_cache[idx]; \
+ if (!identifier) \
+ strub_cache[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
@@ -1604,31 +1617,32 @@ public:
virtual unsigned int execute (function *);
/* Define on demand and cache some types we use often. */
-#define DEF_TYPE(NAME, INIT) \
+#define DEF_TYPE(IDX, NAME, INIT) \
static inline tree get_ ## NAME () { \
- static tree type = NULL_TREE; \
+ int idx = STRUB_TYPE_BASE + IDX; \
+ static tree type = strub_cache[idx]; \
if (!type) \
- type = (INIT); \
+ strub_cache[idx] = type = (INIT); \
return type; \
}
/* Use a distinct ptr_type_node to denote the watermark, so that we can
recognize it in arg lists and avoid modifying types twice. */
- DEF_TYPE (wmt, build_variant_type_copy (ptr_type_node))
+ DEF_TYPE (0, wmt, build_variant_type_copy (ptr_type_node))
- DEF_TYPE (pwmt, build_reference_type (get_wmt ()))
+ DEF_TYPE (1, pwmt, build_reference_type (get_wmt ()))
- DEF_TYPE (qpwmt,
+ DEF_TYPE (2, qpwmt,
build_qualified_type (get_pwmt (),
TYPE_QUAL_RESTRICT
/* | TYPE_QUAL_CONST */))
- DEF_TYPE (qptr,
+ DEF_TYPE (3, qptr,
build_qualified_type (ptr_type_node,
TYPE_QUAL_RESTRICT
| TYPE_QUAL_CONST))
- DEF_TYPE (qpvalst,
+ DEF_TYPE (4, qpvalst,
build_qualified_type (build_reference_type
(va_list_type_node),
TYPE_QUAL_RESTRICT
@@ -1697,17 +1711,18 @@ public:
#undef DEF_SS_BUILTIN
/* Define strub identifiers on demand. */
-#define DEF_IDENT(NAME) \
- static inline tree get_ ## NAME () { \
- static tree identifier = NULL_TREE; \
- if (!identifier) \
- identifier = get_identifier (".strub." #NAME); \
- return identifier; \
+#define DEF_IDENT(IDX, NAME) \
+ static inline tree get_ ## NAME () { \
+ int idx = STRUB_IDENT_BASE + IDX; \
+ tree identifier = strub_cache[idx]; \
+ if (!identifier) \
+ strub_cache[idx] = identifier = get_identifier (".strub." #NAME); \
+ return identifier; \
}
- DEF_IDENT (watermark_ptr)
- DEF_IDENT (va_list_ptr)
- DEF_IDENT (apply_args)
+ DEF_IDENT (0, watermark_ptr)
+ DEF_IDENT (1, va_list_ptr)
+ DEF_IDENT (2, apply_args)
#undef DEF_IDENT
@@ -3432,3 +3447,5 @@ make_pass_ipa_strub (gcc::context *ctxt)
{
return new pass_ipa_strub (ctxt);
}
+
+#include "gt-ipa-strub.h"
^ permalink raw reply [flat|nested] 7+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] strub: cope with identifier GCing
@ 2023-10-05 6:15 Alexandre Oliva
0 siblings, 0 replies; 7+ messages in thread
From: Alexandre Oliva @ 2023-10-05 6:15 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:247741b3065548950ad3d2f7f8bdc2c8db8a08b5
commit 247741b3065548950ad3d2f7f8bdc2c8db8a08b5
Author: Alexandre Oliva <oliva@gnu.org>
Date: Thu Oct 5 02:32:15 2023 -0300
strub: cope with identifier GCing
Diff:
---
gcc/Makefile.in | 1 +
gcc/gengtype-lex.l | 3 +++
gcc/ipa-strub.cc | 31 ++++++++++++++++++-------------
3 files changed, 22 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/gengtype-lex.l b/gcc/gengtype-lex.l
index 34837d9dc9a..a7bb44cf2b9 100644
--- a/gcc/gengtype-lex.l
+++ b/gcc/gengtype-lex.l
@@ -165,6 +165,9 @@ CXX_KEYWORD inline|public:|private:|protected:|template|operator|friend|static|m
[(){},*:<>;=%/|+\!\?\.-] { return yytext[0]; }
/* ignore pp-directives */
+^{HWS}"#"{HWS}[a-z_]+([^\n]*"\\"\n)+[^\n]*\n {
+ update_lineno (yytext, yyleng);
+}
^{HWS}"#"{HWS}[a-z_]+[^\n]*\n {lexer_line.line++;}
. {
diff --git a/gcc/ipa-strub.cc b/gcc/ipa-strub.cc
index 861cd0cffa0..52f5761aa61 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 GTY(()) tree 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"
^ permalink raw reply [flat|nested] 7+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] strub: cope with identifier GCing
@ 2023-10-05 6:12 Alexandre Oliva
0 siblings, 0 replies; 7+ messages in thread
From: Alexandre Oliva @ 2023-10-05 6:12 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:2eb3fe8889474502275348304dad8ed5de76b505
commit 2eb3fe8889474502275348304dad8ed5de76b505
Author: Alexandre Oliva <oliva@gnu.org>
Date: Thu Oct 5 02:32:15 2023 -0300
strub: cope with identifier GCing
Diff:
---
gcc/Makefile.in | 1 +
gcc/gengtype-lex.l | 3 +++
gcc/ipa-strub.cc | 31 ++++++++++++++++++-------------
3 files changed, 22 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/gengtype-lex.l b/gcc/gengtype-lex.l
index 34837d9dc9a..e6c18412e06 100644
--- a/gcc/gengtype-lex.l
+++ b/gcc/gengtype-lex.l
@@ -165,6 +165,9 @@ CXX_KEYWORD inline|public:|private:|protected:|template|operator|friend|static|m
[(){},*:<>;=%/|+\!\?\.-] { return yytext[0]; }
/* ignore pp-directives */
+^{HWS}"#"{HWS}[a-z_]+([^\n]*"\\"\n)*[^\n]*\n {
+ update_lineno (yytext, yyleng);
+}
^{HWS}"#"{HWS}[a-z_]+[^\n]*\n {lexer_line.line++;}
. {
diff --git a/gcc/ipa-strub.cc b/gcc/ipa-strub.cc
index 861cd0cffa0..52f5761aa61 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 GTY(()) tree 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"
^ permalink raw reply [flat|nested] 7+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] strub: cope with identifier GCing
@ 2023-10-05 5:37 Alexandre Oliva
0 siblings, 0 replies; 7+ messages in thread
From: Alexandre Oliva @ 2023-10-05 5:37 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:83219fa94674544803ab599ab728b0628fa700ed
commit 83219fa94674544803ab599ab728b0628fa700ed
Author: Alexandre Oliva <oliva@gnu.org>
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"
^ permalink raw reply [flat|nested] 7+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] strub: cope with identifier GCing
@ 2023-10-05 5:33 Alexandre Oliva
0 siblings, 0 replies; 7+ messages in thread
From: Alexandre Oliva @ 2023-10-05 5:33 UTC (permalink / raw)
To: gcc-cvs
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"
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-10-20 3:48 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-20 3:48 [gcc(refs/users/aoliva/heads/testme)] strub: cope with identifier GCing Alexandre Oliva
-- strict thread matches above, loose matches on Subject: below --
2023-10-06 4:33 Alexandre Oliva
2023-10-06 4:29 Alexandre Oliva
2023-10-05 6:15 Alexandre Oliva
2023-10-05 6:12 Alexandre Oliva
2023-10-05 5:37 Alexandre Oliva
2023-10-05 5:33 Alexandre Oliva
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).