public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andreas Krebbel <krebbel@linux.ibm.com>
To: gcc-patches@gcc.gnu.org
Subject: [Committed] IBM Z: Add GTY marker to builtin data structures
Date: Tue, 14 Nov 2023 11:51:27 +0100	[thread overview]
Message-ID: <20231114105127.303538-1-krebbel@linux.ibm.com> (raw)

This adds GTY markers to s390_builtin_types, s390_builtin_fn_types,
and s390_builtin_decls. These were missing causing problems in
particular when using builtins after including a precompiled header.

Unfortunately the declaration of these data structures use enum values
from s390-builtins.h.  This file however is not included everywhere
and is rather large.  In order to include it only for the purpose of
gtype-desc.cc we place a preprocessed copy of it in the build
directory and include only this.

This is going to be backported to GCC 12 and 13.

Bootstrapped and regression tested on IBM Z.

Committed to mainline.

gcc/ChangeLog:

	* config.gcc: Add s390-gen-builtins.h to target_gtfiles.
	* config/s390/s390-builtins.h (s390_builtin_types)
	(s390_builtin_fn_types, s390_builtin_decls): Add GTY marker.
	* config/s390/t-s390 (EXTRA_GTYPE_DEPS): Add s390-gen-builtins.h.
	Add build rule for s390-gen-builtins.h.
---
 gcc/config.gcc                  |  1 +
 gcc/config/s390/s390-builtins.h | 10 +++++-----
 gcc/config/s390/t-s390          |  4 ++++
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/gcc/config.gcc b/gcc/config.gcc
index ba6d63e33ac..c1460ca354e 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -571,6 +571,7 @@ s390*-*-*)
 	d_target_objs="s390-d.o"
 	extra_options="${extra_options} fused-madd.opt"
 	extra_headers="s390intrin.h htmintrin.h htmxlintrin.h vecintrin.h"
+	target_gtfiles="./s390-gen-builtins.h"
 	;;
 # Note the 'l'; we need to be able to match e.g. "shle" or "shl".
 sh[123456789lbe]*-*-* | sh-*-*)
diff --git a/gcc/config/s390/s390-builtins.h b/gcc/config/s390/s390-builtins.h
index 45bba876828..84676fe5b3f 100644
--- a/gcc/config/s390/s390-builtins.h
+++ b/gcc/config/s390/s390-builtins.h
@@ -88,8 +88,8 @@ enum s390_builtin_ov_type_index
 
 #define MAX_OV_OPERANDS 6
 
-extern tree s390_builtin_types[BT_MAX];
-extern tree s390_builtin_fn_types[BT_FN_MAX];
+extern GTY(()) tree s390_builtin_types[BT_MAX];
+extern GTY(()) tree s390_builtin_fn_types[BT_FN_MAX];
 
   /* Builtins.  */
 
@@ -172,6 +172,6 @@ opflags_for_builtin (int fcode)
     return opflags_builtin[fcode];
 }
 
-extern tree s390_builtin_decls[S390_BUILTIN_MAX +
-			       S390_OVERLOADED_BUILTIN_MAX +
-			       S390_OVERLOADED_BUILTIN_VAR_MAX];
+extern GTY(()) tree s390_builtin_decls[S390_BUILTIN_MAX +
+				       S390_OVERLOADED_BUILTIN_MAX +
+				       S390_OVERLOADED_BUILTIN_VAR_MAX];
diff --git a/gcc/config/s390/t-s390 b/gcc/config/s390/t-s390
index 828818bed2d..4ab9718f6e2 100644
--- a/gcc/config/s390/t-s390
+++ b/gcc/config/s390/t-s390
@@ -19,6 +19,7 @@
 TM_H += $(srcdir)/config/s390/s390-builtins.def
 TM_H += $(srcdir)/config/s390/s390-builtin-types.def
 PASSES_EXTRA += $(srcdir)/config/s390/s390-passes.def
+EXTRA_GTYPE_DEPS += ./s390-gen-builtins.h
 
 s390-c.o: $(srcdir)/config/s390/s390-c.cc \
   $(srcdir)/config/s390/s390-protos.h $(CONFIG_H) $(SYSTEM_H) coretypes.h \
@@ -30,3 +31,6 @@ s390-c.o: $(srcdir)/config/s390/s390-c.cc \
 s390-d.o: $(srcdir)/config/s390/s390-d.cc
 	$(COMPILE) $<
 	$(POSTCOMPILE)
+
+s390-gen-builtins.h: $(srcdir)/config/s390/s390-builtins.h
+	$(COMPILER) -E $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< > $@
-- 
2.41.0


                 reply	other threads:[~2023-11-14 10:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20231114105127.303538-1-krebbel@linux.ibm.com \
    --to=krebbel@linux.ibm.com \
    --cc=gcc-patches@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).