public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/aoliva/heads/testme)] fix __builtin___clear_cache overrider fallout
@ 2020-12-03 14:06 Alexandre Oliva
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Oliva @ 2020-12-03 14:06 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:1f23042e4f7be22ed26970c5eafd37ef3c5a5ea5

commit 1f23042e4f7be22ed26970c5eafd37ef3c5a5ea5
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Thu Dec 3 10:51:43 2020 -0300

    fix __builtin___clear_cache overrider fallout
    
    Machines that had CLEAR_CACHE_INSN and that would thus issue calls to
    __clear_cache with the default call expander, would fail on languages
    that did not set up the __clear_cache builtin.  This patch arranges
    for all languages to set up this builtin.
    
    Machines or multilibs that had ptr_mode != Pmode, such as aarch64 with
    -milp32, would fail the RTL mode test of the arguments passed to
    __clear_cache, because we'd insist on ptr_mode.  This patch arranges
    for Pmode to be accepted as well.
    
    
    for  gcc/ChangeLog
    
            * tree.c (build_common_builtin_nodes): Declare
            __builtin___clear_cache for all languages.
            * builtins.c (maybe_emit_call_builtin___clear_cache): Accept
            Pmode arguments.

Diff:
---
 gcc/builtins.c | 3 ++-
 gcc/tree.c     | 6 ++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/gcc/builtins.c b/gcc/builtins.c
index ecc12e69c14..cd30de8bfb0 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -7793,7 +7793,8 @@ default_emit_call_builtin___clear_cache (rtx begin, rtx end)
 void
 maybe_emit_call_builtin___clear_cache (rtx begin, rtx end)
 {
-  if (GET_MODE (begin) != ptr_mode || GET_MODE (end) != ptr_mode)
+  if ((GET_MODE (begin) != ptr_mode && GET_MODE (begin) != Pmode)
+      || (GET_MODE (end) != ptr_mode && GET_MODE (end) != Pmode))
     {
       error ("both arguments to %<__builtin___clear_cache%> must be pointers");
       return;
diff --git a/gcc/tree.c b/gcc/tree.c
index 52a145dd018..72311005f57 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -10733,6 +10733,12 @@ build_common_builtin_nodes (void)
 
   ftype = build_function_type_list (void_type_node,
 				    ptr_type_node, ptr_type_node, NULL_TREE);
+  if (!builtin_decl_explicit_p (BUILT_IN_CLEAR_CACHE))
+    local_define_builtin ("__builtin___clear_cache", ftype,
+			  BUILT_IN_CLEAR_CACHE,
+			  "__builtin___clear_cache",
+			  ECF_NOTHROW);
+
   local_define_builtin ("__builtin_nonlocal_goto", ftype,
 			BUILT_IN_NONLOCAL_GOTO,
 			"__builtin_nonlocal_goto",


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [gcc(refs/users/aoliva/heads/testme)] fix __builtin___clear_cache overrider fallout
@ 2020-12-03 14:09 Alexandre Oliva
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Oliva @ 2020-12-03 14:09 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:7a558c8b71412376b5974fee3362fa37b731d11d

commit 7a558c8b71412376b5974fee3362fa37b731d11d
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Thu Dec 3 10:51:43 2020 -0300

    fix __builtin___clear_cache overrider fallout
    
    Machines that had CLEAR_CACHE_INSN and that would thus issue calls to
    __clear_cache with the default call expander, would fail on languages
    that did not set up the __clear_cache builtin.  This patch arranges
    for all languages to set up this builtin.
    
    Machines or multilibs that had ptr_mode != Pmode, such as aarch64 with
    -mabi=ilp32, would fail the RTL mode test of the arguments passed to
    __clear_cache, because we'd insist on ptr_mode.  This patch arranges
    for Pmode to be accepted as well.
    
    
    for  gcc/ChangeLog
    
            * tree.c (build_common_builtin_nodes): Declare
            __builtin___clear_cache for all languages.
            * builtins.c (maybe_emit_call_builtin___clear_cache): Accept
            Pmode arguments.

Diff:
---
 gcc/builtins.c | 3 ++-
 gcc/tree.c     | 6 ++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/gcc/builtins.c b/gcc/builtins.c
index ecc12e69c14..cd30de8bfb0 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -7793,7 +7793,8 @@ default_emit_call_builtin___clear_cache (rtx begin, rtx end)
 void
 maybe_emit_call_builtin___clear_cache (rtx begin, rtx end)
 {
-  if (GET_MODE (begin) != ptr_mode || GET_MODE (end) != ptr_mode)
+  if ((GET_MODE (begin) != ptr_mode && GET_MODE (begin) != Pmode)
+      || (GET_MODE (end) != ptr_mode && GET_MODE (end) != Pmode))
     {
       error ("both arguments to %<__builtin___clear_cache%> must be pointers");
       return;
diff --git a/gcc/tree.c b/gcc/tree.c
index 52a145dd018..72311005f57 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -10733,6 +10733,12 @@ build_common_builtin_nodes (void)
 
   ftype = build_function_type_list (void_type_node,
 				    ptr_type_node, ptr_type_node, NULL_TREE);
+  if (!builtin_decl_explicit_p (BUILT_IN_CLEAR_CACHE))
+    local_define_builtin ("__builtin___clear_cache", ftype,
+			  BUILT_IN_CLEAR_CACHE,
+			  "__builtin___clear_cache",
+			  ECF_NOTHROW);
+
   local_define_builtin ("__builtin_nonlocal_goto", ftype,
 			BUILT_IN_NONLOCAL_GOTO,
 			"__builtin_nonlocal_goto",


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-03 14:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-03 14:06 [gcc(refs/users/aoliva/heads/testme)] fix __builtin___clear_cache overrider fallout Alexandre Oliva
2020-12-03 14:09 Alexandre Oliva

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