public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/meissner/heads/work057)] Add -mconst-anchor.
@ 2021-06-30  2:24 Michael Meissner
  0 siblings, 0 replies; only message in thread
From: Michael Meissner @ 2021-06-30  2:24 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:2f8570182df5993e19a926b916798a84d9a7002c

commit 2f8570182df5993e19a926b916798a84d9a7002c
Author: Michael Meissner <meissner@linux.ibm.com>
Date:   Tue Jun 29 22:24:40 2021 -0400

    Add -mconst-anchor.
    
    gcc/
    2021-06-28  Michael Meissner  <meissner@linux.ibm.com>
    
            * config/rs6000/rs6000.c (rs6000_option_override_internal): If
            -mconst-anchor, set the const anchor size to the maximum,
            depending on the maximum address size.
            * config/rs6000/rs6000.opt (-mconst-anchor): New switch.

Diff:
---
 gcc/config/rs6000/rs6000.c   | 5 +++++
 gcc/config/rs6000/rs6000.opt | 4 ++++
 2 files changed, 9 insertions(+)

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 2c249e186e1..5063504d997 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -4501,6 +4501,11 @@ rs6000_option_override_internal (bool global_init_p)
   if (!TARGET_PCREL && TARGET_PCREL_OPT)
     rs6000_isa_flags &= ~OPTION_MASK_PCREL_OPT;
 
+  /* Possibly set the const_anchor to the maximum value, based on whether we
+     have prefixed addressing.  */
+  if (TARGET_CONST_ANCHOR)
+    targetm.const_anchor = HOST_WIDE_INT_1 << (TARGET_PREFIXED ? 33 : 15);
+
   if (TARGET_DEBUG_REG || TARGET_DEBUG_TARGET)
     rs6000_print_isa_options (stderr, 0, "after subtarget", rs6000_isa_flags);
 
diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt
index 0538db387dc..70f89d42113 100644
--- a/gcc/config/rs6000/rs6000.opt
+++ b/gcc/config/rs6000/rs6000.opt
@@ -639,3 +639,7 @@ Enable instructions that guard against return-oriented programming attacks.
 mprivileged
 Target Var(rs6000_privileged) Init(0)
 Generate code that will run in privileged state.
+
+mconst-anchor
+Target Undocumented Var(TARGET_CONST_ANCHOR) Save
+Set targetm.const_anchor


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

only message in thread, other threads:[~2021-06-30  2:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-30  2:24 [gcc(refs/users/meissner/heads/work057)] Add -mconst-anchor Michael Meissner

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