public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ARM/heads/morello)] Implement valid-pointer-mode for aarch64
@ 2022-05-05 12:04 Matthew Malcomson
  0 siblings, 0 replies; only message in thread
From: Matthew Malcomson @ 2022-05-05 12:04 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:9336ef23d4c7324d7269417d21ba2f7fc0a60057

commit 9336ef23d4c7324d7269417d21ba2f7fc0a60057
Author: Matthew Malcomson <matthew.malcomson@arm.com>
Date:   Thu Mar 17 15:49:20 2022 +0000

    Implement valid-pointer-mode for aarch64
    
    This allows capability versions of Pmode and ptr_mode as well as the
    standard versions.

Diff:
---
 gcc/config/aarch64/aarch64.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 05b78dac74c..53b6956e78a 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -24777,6 +24777,24 @@ aarch64_capabilities_in_hardware (void)
     return false;
 }
 
+/* Implement TARGET_VALID_POINTER_MODE hook.  */
+bool
+aarch64_valid_pointer_mode (scalar_addr_mode mode)
+{
+  /* For Hybrid Morello we support two valid pointer modes:
+      - DImode == Pmode == ptr_mode for all normal integer pointers.
+      - CADImode forcapability  pointers.
+     In order to return "valid" on both of them, we check against the
+     offset mode.  */
+  if (TARGET_CAPABILITY_HYBRID)
+    {
+      scalar_addr_mode omode = offset_mode (mode);
+      return (omode == Pmode || omode == ptr_mode);
+    }
+  else
+    return (mode == Pmode || mode == ptr_mode);
+}
+
 /* Implement the TARGET_DWARF_FRAME_REG_MODE target hook. This only has an
    impact in Hybrid Capability Morello compilation, where the default
    raw_reg_mode returned would still be CADImode, but we want to use DImode
@@ -25418,6 +25436,9 @@ aarch64_libgcc_floating_mode_supported_p
 #undef TARGET_ASM_DECLARE_CONSTANT_NAME
 #define TARGET_ASM_DECLARE_CONSTANT_NAME aarch64_declare_constant_name
 
+#undef TARGET_VALID_POINTER_MODE
+#define TARGET_VALID_POINTER_MODE aarch64_valid_pointer_mode
+
 #undef TARGET_UNWIND_WORD_MODE
 #define TARGET_UNWIND_WORD_MODE		aarch64_unwind_word_mode


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-05 12:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-05 12:04 [gcc(refs/vendors/ARM/heads/morello)] Implement valid-pointer-mode for aarch64 Matthew Malcomson

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).