diff mbox series

[16/32] Remove global call sets: function.c

Message ID mptlfuuwsv6.fsf@arm.com
State New
Headers show
Series Support multiple ABIs in the same translation unit | expand

Commit Message

Richard Sandiford Sept. 11, 2019, 7:11 p.m. UTC
Whatever the rights and wrongs of the way aggregate_value_p
handles call-preserved registers, it's a de facto part of the ABI,
so we shouldn't change it.  The patch simply extends the current
approach to whatever call-preserved set the function happens to
be using.


2019-09-11  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* function.c (aggregate_value_p): Work out which ABI the
	function is using before testing which registers are at least
	partly preserved by a call.

Comments

Jeff Law Sept. 29, 2019, 9:10 p.m. UTC | #1
On 9/11/19 1:11 PM, Richard Sandiford wrote:
> Whatever the rights and wrongs of the way aggregate_value_p
> handles call-preserved registers, it's a de facto part of the ABI,
> so we shouldn't change it.  The patch simply extends the current
> approach to whatever call-preserved set the function happens to
> be using.
> 
> 
> 2019-09-11  Richard Sandiford  <richard.sandiford@arm.com>
> 
> gcc/
> 	* function.c (aggregate_value_p): Work out which ABI the
> 	function is using before testing which registers are at least
> 	partly preserved by a call.
> 
OK
jeff
diff mbox series

Patch

Index: gcc/function.c
===================================================================
--- gcc/function.c	2019-09-11 19:47:07.490381964 +0100
+++ gcc/function.c	2019-09-11 19:48:18.357882573 +0100
@@ -2120,10 +2120,17 @@  aggregate_value_p (const_tree exp, const
   if (!REG_P (reg))
     return 0;
 
+  /* Use the default ABI if the type of the function isn't known.
+     The scheme for handling interoperability between different ABIs
+     requires us to be able to tell when we're calling a function with
+     a nondefault ABI.  */
+  const predefined_function_abi &abi = (fntype
+					? fntype_abi (fntype)
+					: default_function_abi);
   regno = REGNO (reg);
   nregs = hard_regno_nregs (regno, TYPE_MODE (type));
   for (i = 0; i < nregs; i++)
-    if (! call_used_or_fixed_reg_p (regno + i))
+    if (!fixed_regs[regno + i] && !abi.clobbers_full_reg_p (regno + i))
       return 1;
 
   return 0;