diff options
author | Alan Modra <amodra@gmail.com> | 2015-02-06 09:22:24 +1030 |
---|---|---|
committer | Alan Modra <amodra@gcc.gnu.org> | 2015-02-06 09:22:24 +1030 |
commit | b871a06f6f0c3a76a58cd71ff07023afbd9d58a3 (patch) | |
tree | d003f5f0753276685092348fae95942c86959119 | |
parent | 2f72ca141dad4a52f34220c2be7113dca3dc4f0d (diff) | |
download | gcc-b871a06f6f0c3a76a58cd71ff07023afbd9d58a3.zip gcc-b871a06f6f0c3a76a58cd71ff07023afbd9d58a3.tar.gz gcc-b871a06f6f0c3a76a58cd71ff07023afbd9d58a3.tar.bz2 |
re PR target/64876 (Regressions in gcc-testresults for powerpc64 gccgo in 5.0 due to change for static chain for closures (219776))
PR target/64876
* config/rs6000/rs6000.c (chain_already_loaded): New function.
(rs6000_call_aix): Use it.
From-SVN: r220463
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 26 |
2 files changed, 31 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b4c14d1..90cee313 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-02-06 Alan Modra <amodra@gmail.com> + + PR target/64876 + * config/rs6000/rs6000.c (chain_already_loaded): New function. + (rs6000_call_aix): Use it. + 2015-02-05 Jan Hubicka <hubicka@ucw.cz> * ipa-cp.c (ipa_value_from_jfunc, ipa_context_from_jfunc): Add bounds diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 356955a..4f88328 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -32919,6 +32919,28 @@ rs6000_legitimate_constant_p (machine_mode mode, rtx x) } +/* Return TRUE iff the sequence ending in LAST sets the static chain. */ + +static bool +chain_already_loaded (rtx_insn *last) +{ + for (; last != NULL; last = PREV_INSN (last)) + { + if (NONJUMP_INSN_P (last)) + { + rtx patt = PATTERN (last); + + if (GET_CODE (patt) == SET) + { + rtx lhs = XEXP (patt, 0); + + if (REG_P (lhs) && REGNO (lhs) == STATIC_CHAIN_REGNUM) + return true; + } + } + } + return false; +} /* Expand code to perform a call under the AIX or ELFv2 ABI. */ @@ -33002,7 +33024,9 @@ rs6000_call_aix (rtx value, rtx func_desc, rtx flag, rtx cookie) 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) + if (!direct_call_p + && TARGET_POINTERS_TO_NESTED_FUNCTIONS + && !chain_already_loaded (crtl->emit.sequence_stack->last)) { rtx sc_reg = gen_rtx_REG (Pmode, STATIC_CHAIN_REGNUM); rtx func_sc_offset = GEN_INT (2 * GET_MODE_SIZE (Pmode)); |