diff options
author | kkojima <kkojima@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-11-11 02:12:42 +0000 |
---|---|---|
committer | kkojima <kkojima@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-11-11 02:12:42 +0000 |
commit | 360738f1a5bd169ed4049132a474a1adb716675d (patch) | |
tree | 0b563d56025cd02e2b9c54a6bde629270c77a6e2 /gcc/calls.c | |
parent | 4eace1907a493f418d1a9123349380be5ff210a1 (diff) | |
download | gcc-360738f1a5bd169ed4049132a474a1adb716675d.tar.gz |
PR target/24445
* calls.c (expand_call): Copy a return value to a plain register
if needed.
* gcc.dg/pr24445.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@106774 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/calls.c')
-rw-r--r-- | gcc/calls.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/calls.c b/gcc/calls.c index 1a680ae5159..920c81575e0 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -2857,6 +2857,14 @@ expand_call (tree exp, rtx target, int ignore) && GET_MODE (target) == TYPE_MODE (TREE_TYPE (exp)) && GET_MODE (target) == GET_MODE (valreg)) { + /* We have to copy a return value in a CLASS_LIKELY_SPILLED hard + reg to a plain register. */ + if (REG_P (valreg) + && HARD_REGISTER_P (valreg) + && CLASS_LIKELY_SPILLED_P (REGNO_REG_CLASS (REGNO (valreg))) + && !(REG_P (target) && !HARD_REGISTER_P (target))) + valreg = copy_to_reg (valreg); + /* TARGET and VALREG cannot be equal at this point because the latter would not have REG_FUNCTION_VALUE_P true, while the former would if it were referring to the same register. |