diff mbox series

[16/34] rs6000: Darwin builtin support

Message ID d48b38e85e22dd01e95218763e2db2882baca4ef.1627562851.git.wschmidt@linux.ibm.com
State New
Headers show
Series Replace the Power target-specific builtin machinery | expand

Commit Message

Bill Schmidt July 29, 2021, 1:31 p.m. UTC
2021-03-04  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/darwin.h (SUBTARGET_INIT_BUILTINS): Use the new
	decl when new_builtins_are_live.
	* config/rs6000/rs6000-builtin-new.def (__builtin_cfstring): New
	built-in.
---
 gcc/config/rs6000/darwin.h               | 8 ++++++--
 gcc/config/rs6000/rs6000-builtin-new.def | 6 ++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

Comments

Segher Boessenkool Aug. 27, 2021, 6:01 p.m. UTC | #1
On Thu, Jul 29, 2021 at 08:31:03AM -0500, Bill Schmidt wrote:
> 	* config/rs6000/darwin.h (SUBTARGET_INIT_BUILTINS): Use the new
> 	decl when new_builtins_are_live.
> 	* config/rs6000/rs6000-builtin-new.def (__builtin_cfstring): New
> 	built-in.

Okay for trunk.  Thanks!


Segher
diff mbox series

Patch

diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h
index 42f39e60305..6abf8e84f54 100644
--- a/gcc/config/rs6000/darwin.h
+++ b/gcc/config/rs6000/darwin.h
@@ -504,8 +504,12 @@ 
 #define SUBTARGET_INIT_BUILTINS						\
 do {									\
   darwin_patch_builtins ();						\
-  rs6000_builtin_decls[(unsigned) (RS6000_BUILTIN_CFSTRING)]		\
-    = darwin_init_cfstring_builtins ((unsigned) (RS6000_BUILTIN_CFSTRING)); \
+  if (new_builtins_are_live)						\
+    rs6000_builtin_decls_x[(unsigned) (RS6000_BIF_CFSTRING)]		\
+      = darwin_init_cfstring_builtins ((unsigned) (RS6000_BIF_CFSTRING)); \
+  else									\
+    rs6000_builtin_decls[(unsigned) (RS6000_BUILTIN_CFSTRING)]		\
+      = darwin_init_cfstring_builtins ((unsigned) (RS6000_BUILTIN_CFSTRING)); \
 } while(0)
 
 /* So far, there is no rs6000_fold_builtin, if one is introduced, then
diff --git a/gcc/config/rs6000/rs6000-builtin-new.def b/gcc/config/rs6000/rs6000-builtin-new.def
index 322dbe1f713..91dce7fbc91 100644
--- a/gcc/config/rs6000/rs6000-builtin-new.def
+++ b/gcc/config/rs6000/rs6000-builtin-new.def
@@ -187,6 +187,12 @@ 
 ; Builtins that have been around since time immemorial or are just
 ; considered available everywhere.
 [always]
+; __builtin_cfstring is for Darwin, which will replace the decl we
+; create here with another one during subtarget processing.  We just
+; need to ensure it has a slot in the builtin enumeration.
+  void __builtin_cfstring ();
+    CFSTRING nothing {}
+
   void __builtin_cpu_init ();
     CPU_INIT nothing {cpu}