diff mbox

[COMMITTED,1/3] Make TARGET_STATIC_CHAIN allow a function type

Message ID 546DFD68.4080000@redhat.com
State New
Headers show

Commit Message

Richard Henderson Nov. 20, 2014, 2:40 p.m. UTC
On 11/19/2014 08:56 PM, H.J. Lu wrote:
> On Wed, Nov 19, 2014 at 10:04 AM, Jakub Jelinek <jakub@redhat.com> wrote:
>> On Wed, Nov 19, 2014 at 03:58:50PM +0100, Richard Henderson wrote:
>>> As opposed to always being a decl.  This is a prerequisite
>>> to allowing the static chain to be loaded for indirect calls.
>>>
>>>         * targhooks.c (default_static_chain): Remove check for
>>>         DECL_STATIC_CHAIN.
>>>         * config/moxie/moxie.c (moxie_static_chain): Likewise.
>>>         * config/i386/i386.c (ix86_static_chain): Allow decl or type
>>>         as the first argument.
>>>         * config/xtensa/xtensa.c (xtensa_static_chain): Change the name
>>>         of the unused first parameter.
>>>         * doc/tm.texi (TARGET_STATIC_CHAIN): Document the first parameter
>>>         may be a type.
>>>         * target.def (static_chain): Likewise.
>>
>> r217769 broke lots of tests on i686-linux...

Guh.  I thought I tested both multilibs from x86_64, but I guess not.
Anyway, fixed as the comment describes.


r~
PR target/63977
	* config/i386/i386.c (ix86_static_chain): Reinstate the check
	for DECL_STATIC_CHAIN.
diff mbox

Patch

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index fffddfc..6c8dbd6 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -27360,6 +27360,12 @@  ix86_static_chain (const_tree fndecl_or_type, bool incoming_p)
 {
   unsigned regno;
 
+  /* While this function won't be called by the middle-end when a static
+     chain isn't needed, it's also used throughout the backend so it's
+     easiest to keep this check centralized.  */
+  if (DECL_P (fndecl_or_type) && !DECL_STATIC_CHAIN (fndecl_or_type))
+    return NULL;
+
   if (TARGET_64BIT)
     {
       /* We always use R10 in 64-bit mode.  */