public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Matthew Malcomson <matmal01@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/vendors/ARM/heads/morello)] morello: Tidy up defines and enable Morello-specific ones in Hybrid
Date: Thu,  5 May 2022 12:09:59 +0000 (GMT)	[thread overview]
Message-ID: <20220505120959.4DF92385DC03@sourceware.org> (raw)

https://gcc.gnu.org/g:46a374536a91244b517b37e0a36c69800051739a

commit 46a374536a91244b517b37e0a36c69800051739a
Author: Stam Markianos-Wright <stam.markianos-wright@arm.com>
Date:   Fri Apr 29 10:59:32 2022 +0100

    morello: Tidy up defines and enable Morello-specific ones in Hybrid
    
    This patch resolves a couple of the MORELLO TODOs we had in the codebase to
    remove the Morello defines from fake-capability compilation.
    
    It also removes `__CHERI_CAP_PERMISSION_PERMIT_CCALL__` to match the ACLE
    and ensures that the remaining ones are also defined when -march=morello.
    This now matches clang behaviour.

Diff:
---
 gcc/c-family/c-cppbuiltin.c    | 14 +++++---------
 gcc/config/aarch64/aarch64-c.c | 22 +++-------------------
 2 files changed, 8 insertions(+), 28 deletions(-)

diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c
index 8e4c338b8b0..a6c912dc352 100644
--- a/gcc/c-family/c-cppbuiltin.c
+++ b/gcc/c-family/c-cppbuiltin.c
@@ -1457,15 +1457,8 @@ c_cpp_builtins (cpp_reader *pfile)
   builtin_define_type_sizeof ("__SIZEOF_PTRDIFF_T__",
 			      unsigned_ptrdiff_type_node);
 
-  /* MORELLO TODO
-     For the moment we're going to predefine these macros when compiling for
-     fake-capability.
-     This should not stay for very long.
-     It's just here to help Carlos test the glibc build system in the time
-     before we have pure capability codegen.
-     Once we're getting pure-capability code running we should make these
-     predefined macros only available for that.  */
-  if (targetm.capability_mode().exists())
+  if (targetm.capability_mode ().exists ()
+      && targetm.capabilities_in_hardware ())
     {
       /* N.b. I've not found these values defined in a document anywhere.
 	 The values were found by looking at the assembly after using them in
@@ -1482,6 +1475,9 @@ c_cpp_builtins (cpp_reader *pfile)
       builtin_define_with_int_value ("__CHERI_CAP_PERMISSION_PERMIT_EXECUTE__", 32768);
       builtin_define_with_int_value ("__CHERI_CAP_PERMISSION_PERMIT_STORE__", 65536);
       builtin_define_with_int_value ("__CHERI_CAP_PERMISSION_PERMIT_LOAD__", 131072);
+
+      if (targetm.capability_mode ().require () == Pmode)
+	cpp_define (pfile, "__CHERI_PURE_CAPABILITY__");
     }
 
   /* A straightforward target hook doesn't work, because of problems
diff --git a/gcc/config/aarch64/aarch64-c.c b/gcc/config/aarch64/aarch64-c.c
index 72036213cc5..4798d80407e 100644
--- a/gcc/config/aarch64/aarch64-c.c
+++ b/gcc/config/aarch64/aarch64-c.c
@@ -140,32 +140,16 @@ aarch64_update_cpp_builtins (cpp_reader *pfile)
 
   aarch64_def_or_undef (TARGET_CAPABILITY_ANY,
 			"__GCC_ARM_CAPABILITY_ANY", pfile);
-  /* MORELLO TODO
-     For the moment we're going to predefine these macros when compiling for
-     fake-capability.
-     This should not stay for very long.
-     It's just here to help Carlos test the glibc build system in the time
-     before we have pure capability codegen.
-     Once we're getting pure-capability code running we should make these
-     predefined macros only available for that.  */
   aarch64_def_or_undef (AARCH64_ISA_C64, "__ARM_FEATURE_C64", pfile);
-  if (TARGET_CAPABILITY_PURE || TARGET_CAPABILITY_FAKE)
+
+  if (TARGET_MORELLO)
     {
-      /* N.b. I've only found the values for __ARM_CAP* defined in a document.
-	 The others were found by looking at the assembly after using them in
-	 the compiler explorer.  */
-      cpp_undef (pfile, "__CHERI_CAP_PERMISSION_PERMIT_CCALL__");
+      /* These defines are Morello-specific, as per the Morello ACLE.  */
       builtin_define_with_int_value ("__ARM_CAP_PERMISSION_EXECUTIVE__", 2);
       builtin_define_with_int_value ("__ARM_CAP_PERMISSION_MUTABLE_LOAD__", 64);
       builtin_define_with_int_value ("__ARM_CAP_PERMISSION_COMPARTMENT_ID__", 128);
       builtin_define_with_int_value ("__ARM_CAP_PERMISSION_BRANCH_SEALED_PAIR__", 256);
     }
-  /* MORELLO TODO I guess there should be a hook to give the information of
-     whether we're targetting a pure capability ABI or not the frontend so that
-     `__CHERI_PURE_CAPABILITY__` can be defined in the `c_cpp_builtins` in the
-     C frontend code rather than in the backend.  */
-  aarch64_def_or_undef (TARGET_CAPABILITY_PURE, "__CHERI_PURE_CAPABILITY__",
-			pfile);
 
   aarch64_def_or_undef (TARGET_CRYPTO, "__ARM_FEATURE_CRYPTO", pfile);
   aarch64_def_or_undef (TARGET_SIMD_RDMA, "__ARM_FEATURE_QRDMX", pfile);


                 reply	other threads:[~2022-05-05 12:09 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=20220505120959.4DF92385DC03@sourceware.org \
    --to=matmal01@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).