rs6000.c (rs6000_call_aix): For the AIX ABI, do not load the static chain if the call was originally direct.

* config/rs6000/rs6000.c (rs6000_call_aix): For the AIX ABI, do not
	load the static chain if the call was originally direct.

From-SVN: r218040
This commit is contained in:
Eric Botcazou 2014-11-25 09:07:25 +00:00 committed by Eric Botcazou
parent b286be940a
commit 26ed270e0f
4 changed files with 48 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2014-11-25 Eric Botcazou <ebotcazou@adacore.com>
* config/rs6000/rs6000.c (rs6000_call_aix): For the AIX ABI, do not
load the static chain if the call was originally direct.
2014-11-25 Jan Hubicka <hubicka@ucw.cz>
PR ipa/64059

View File

@ -32853,6 +32853,8 @@ rs6000_legitimate_constant_p (machine_mode mode, rtx x)
void
rs6000_call_aix (rtx value, rtx func_desc, rtx flag, rtx cookie)
{
const bool direct_call_p
= GET_CODE (func_desc) == SYMBOL_REF && SYMBOL_REF_FUNCTION_P (func_desc);
rtx toc_reg = gen_rtx_REG (Pmode, TOC_REGNUM);
rtx toc_load = NULL_RTX;
rtx toc_restore = NULL_RTX;
@ -32921,8 +32923,11 @@ rs6000_call_aix (rtx value, rtx func_desc, rtx flag, rtx cookie)
func_toc_offset));
toc_load = gen_rtx_USE (VOIDmode, func_toc_mem);
/* If we have a static chain, load it up. */
if (TARGET_POINTERS_TO_NESTED_FUNCTIONS)
/* If we have a static chain, load it up. But, if the call was
originally direct, the 3rd word has not been written since no
trampoline has been built, so we ought not to load it, lest we
override a static chain value. */
if (!direct_call_p && TARGET_POINTERS_TO_NESTED_FUNCTIONS)
{
rtx sc_reg = gen_rtx_REG (Pmode, STATIC_CHAIN_REGNUM);
rtx func_sc_offset = GEN_INT (2 * GET_MODE_SIZE (Pmode));

View File

@ -1,3 +1,7 @@
2014-10-25 Eric Botcazou <ebotcazou@adacore.com>
* gcc.target/powerpc/longcall-2.c: New test.
2014-11-25 Marek Polacek <polacek@redhat.com>
PR c/63877

View File

@ -0,0 +1,32 @@
/* { dg-do run } */
/* { dg-options "-mlongcall" } */
extern void abort (void);
#define VAL 12345678
int j = VAL;
void
bar (void)
{
if (j != VAL)
abort ();
}
int
main (void)
{
int i = VAL;
int foo (void)
{
if (i != VAL)
abort ();
}
foo ();
bar ();
return 0;
}