pa.c (pa_callee_copies): New function.
authorJohn David Anglin <danglin@gcc.gnu.org>
Sun, 11 Dec 2016 19:08:47 +0000 (19:08 +0000)
committerJohn David Anglin <danglin@gcc.gnu.org>
Sun, 11 Dec 2016 19:08:47 +0000 (19:08 +0000)
* config/pa/pa.c (pa_callee_copies): New function.
* config/pa/pa.opt (mcaller-copies): New option.
* doc/invoke.texi (mcaller-copies): Document option.

From-SVN: r243531

gcc/ChangeLog
gcc/config/pa/pa.c
gcc/config/pa/pa.opt
gcc/doc/invoke.texi

index 24a7fdd8a979b807d1dd4d8a0ad8c48e3229e5a3..54558cdffd9a5de4b83a6f7a7a7548fff79feb96 100644 (file)
@@ -1,3 +1,9 @@
+2012-12-11  John David Anglin  <danglin@gcc.gnu.org>
+
+       * config/pa/pa.c (pa_callee_copies): New function.
+       * config/pa/pa.opt (mcaller-copies): New option.
+       * doc/invoke.texi (mcaller-copies): Document option.
+
 2016-12-11  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/70799
index c8ce083858fc2e1aaff708b7988149d17985a631..6d18dfe37aeab2c14b976377ded4a9c996706b7b 100644 (file)
@@ -195,6 +195,8 @@ static bool pa_cannot_force_const_mem (machine_mode, rtx);
 static bool pa_legitimate_constant_p (machine_mode, rtx);
 static unsigned int pa_section_type_flags (tree, const char *, int);
 static bool pa_legitimate_address_p (machine_mode, rtx, bool);
+static bool pa_callee_copies (cumulative_args_t, machine_mode,
+                             const_tree, bool);
 
 /* The following extra sections are only used for SOM.  */
 static GTY(()) section *som_readonly_data_section;
@@ -343,7 +345,7 @@ static size_t n_deferred_plabels = 0;
 #undef TARGET_PASS_BY_REFERENCE
 #define TARGET_PASS_BY_REFERENCE pa_pass_by_reference
 #undef TARGET_CALLEE_COPIES
-#define TARGET_CALLEE_COPIES hook_bool_CUMULATIVE_ARGS_mode_tree_bool_true
+#define TARGET_CALLEE_COPIES pa_callee_copies
 #undef TARGET_ARG_PARTIAL_BYTES
 #define TARGET_ARG_PARTIAL_BYTES pa_arg_partial_bytes
 #undef TARGET_FUNCTION_ARG
@@ -10720,4 +10722,19 @@ pa_maybe_emit_compare_and_swap_exchange_loop (rtx target, rtx mem, rtx val)
   return NULL_RTX;
 }
 
+/* Implement TARGET_CALLEE_COPIES.  The callee is responsible for copying
+   arguments passed by hidden reference in the 32-bit HP runtime.  Users
+   can override this behavior for better compatibility with openmp at the
+   risk of library incompatibilities.  Arguments are always passed by value
+   in the 64-bit HP runtime.  */
+
+static bool
+pa_callee_copies (cumulative_args_t cum ATTRIBUTE_UNUSED,
+                 machine_mode mode ATTRIBUTE_UNUSED,
+                 const_tree type ATTRIBUTE_UNUSED,
+                 bool named ATTRIBUTE_UNUSED)
+{
+  return !TARGET_CALLER_COPIES;
+}
+
 #include "gt-pa.h"
index 9370b40ae804fb68fd72f0e3589ecf402710a37c..c15353de353bffe17e3449b210459f88e4293e33 100644 (file)
@@ -41,6 +41,10 @@ mbig-switch
 Target Ignore
 Does nothing.  Preserved for backward compatibility.
 
+mcaller-copies
+Target Report Mask(CALLER_COPIES)
+Caller copies function arguments passed by hidden reference.
+
 mdisable-fpregs
 Target Report Mask(DISABLE_FPREGS)
 Disable FP regs.
index 0c6123269a33250b4e6424017acdab9520a315e7..b211667d8fd8cda768d77cf17ea2c154b3411869 100644 (file)
@@ -763,7 +763,7 @@ Objective-C and Objective-C++ Dialects}.
 
 @emph{HPPA Options}
 @gccoptlist{-march=@var{architecture-type} @gol
--mdisable-fpregs  -mdisable-indexing @gol
+-mcaller-copies  -mdisable-fpregs  -mdisable-indexing @gol
 -mfast-indirect-calls  -mgas  -mgnu-ld   -mhp-ld @gol
 -mfixed-range=@var{register-range} @gol
 -mjump-in-delay -mlinker-opt -mlong-calls @gol
@@ -17465,6 +17465,14 @@ other way around.
 @opindex mpa-risc-2-0
 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
 
+@item -mcaller-copies
+@opindex mcaller-copies
+The caller copies function arguments passed by hidden reference.  This
+option should be used with care as it is not compatible with the default
+32-bit runtime.  However, only aggregates larger than eight bytes are
+passed by hidden reference and the option provides better compatibility
+with openmp.
+
 @item -mjump-in-delay
 @opindex mjump-in-delay
 This option is ignored and provided for compatibility purposes only.