aboutsummaryrefslogtreecommitdiff
path: root/gcc/mode-switching.c
diff options
context:
space:
mode:
authorUros Bizjak <ubizjak@gmail.com>2012-11-05 19:46:31 +0000
committerUros Bizjak <ubizjak@gmail.com>2012-11-05 19:46:31 +0000
commitd5a87cc6560e129b5994a2ab7fa02fd75b372d88 (patch)
tree033e1f770ad19a6394eaed9b596b3483d80fd1bc /gcc/mode-switching.c
parent3ac8df77dff8dc8b4ceeba35c618c2667d324255 (diff)
* mode-switching.c (create_pre_exit): Force late switching if
__builtin_{apply,return} emitted a load that require mode, other than MODE_EXIT. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@193182 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/mode-switching.c')
-rw-r--r--gcc/mode-switching.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/mode-switching.c b/gcc/mode-switching.c
index d9f83ca2a3b..2f7455a033c 100644
--- a/gcc/mode-switching.c
+++ b/gcc/mode-switching.c
@@ -1,6 +1,6 @@
/* CPU mode switching
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008,
- 2009, 2010 Free Software Foundation, Inc.
+ 2009, 2010, 2012 Free Software Foundation, Inc.
This file is part of GCC.
@@ -342,6 +342,16 @@ create_pre_exit (int n_entities, int *entity_map, const int *num_modes)
}
if (j >= 0)
{
+ /* __builtin_return emits a sequence of loads to all
+ return registers. One of them might require
+ another mode than MODE_EXIT, even if it is
+ unrelated to the return value, so we want to put
+ the final mode switch after it. */
+ if (maybe_builtin_apply
+ && targetm.calls.function_value_regno_p
+ (copy_start))
+ forced_late_switch = 1;
+
/* For the SH4, floating point loads depend on fpscr,
thus we might need to put the final mode switch
after the return value copy. That is still OK,