summaryrefslogtreecommitdiff
path: root/meta-linaro-toolchain/recipes-devtools/gcc/gcc-4.7/ppc_no_crtsavres.patch
blob: 92a5d9e176fe1f1ddc1f51b0f9c3b1c98e1edb25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
Upstream-Status: Backport

Signed-off-by: Khem Raj

Source-url: http://gcc.gnu.org/ml/gcc-patches/2012-05/msg01362.html

Currently, powerpc-linux gcc -Os -mno-multiple uses out-of-linux gpr
save and restore functions when saving/restoring just one gpr.  That's
quite silly since the function call requires more instructions and is
slower than an inline save/restore.  The only case where it might win
is when no fprs are restored and the restore function can tear down
the frame and exit (also loading up lr on ppc64).  I guess that's how
GP_SAVE_INLINE came to be like it is, ie. it's optimised for the
common case using ldm in the prologue and no fprs.  Still, it isn't
difficult to choose the best combination in all cases, but it does
mean different logic is needed for restores.  I could have implemented
GP_RESTORE_INLINE and FP_RESORE_INLINE macros but it seemed simpler to
just move everything into the one place the macros are invoked.  AIX
and Darwin register cutoff doesn't change with this patch.

This patch also enables out-of-line restores in cases that were
previously disabled due to using inline saves.

Bootstrapped and regression tested powerpc-linux.  OK to apply?

	* aix.h (FP_SAVE_INLINE, GP_SAVE_INLINE): Delete.
	* darwin.h (FP_SAVE_INLINE, GP_SAVE_INLINE): Delete.
	* sysv4.h (FP_SAVE_INLINE, GP_SAVE_INLINE, V_SAVE_INLINE): Delete.
	* config/rs6000/rs6000.c (V_SAVE_INLINE): Delete.
	(rs6000_savres_strategy): Reimplement GP/FP/V_SAVE_INLINE logic.
	For ELF targets, use out-of-line restores for -Os and any number
	of regs if the restore exits, and out-of-line gp save for two or
	more regs.  Use save_reg_p to test for holes in reg restore set.
	Replace "#if" with "if".

Index: gcc-4_7-branch/gcc/config/rs6000/aix.h
===================================================================
--- gcc-4_7-branch.orig/gcc/config/rs6000/aix.h	2012-09-07 12:35:35.000000000 -0700
+++ gcc-4_7-branch/gcc/config/rs6000/aix.h	2012-09-07 15:27:55.215290315 -0700
@@ -207,11 +207,6 @@
   { "link_syscalls",            LINK_SYSCALLS_SPEC },			\
   { "link_libg",                LINK_LIBG_SPEC }
 
-/* Define cutoff for using external functions to save floating point.  */
-#define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) == 62 || (FIRST_REG) == 63)
-/* And similarly for general purpose registers.  */
-#define GP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 32)
-
 #define PROFILE_HOOK(LABEL)   output_profile_hook (LABEL)
 
 /* No version of AIX fully supports AltiVec or 64-bit instructions in
Index: gcc-4_7-branch/gcc/config/rs6000/darwin.h
===================================================================
--- gcc-4_7-branch.orig/gcc/config/rs6000/darwin.h	2012-09-07 12:35:35.000000000 -0700
+++ gcc-4_7-branch/gcc/config/rs6000/darwin.h	2012-09-07 15:27:55.223290316 -0700
@@ -173,16 +173,6 @@
   (RS6000_ALIGN (crtl->outgoing_args_size, 16)		\
    + (STACK_POINTER_OFFSET))
 
-/* Define cutoff for using out-of-line functions to save registers.
-   Currently on Darwin, we implement FP and GPR out-of-line-saves plus the
-   special routine for 'save everything'.  */
-
-#undef FP_SAVE_INLINE
-#define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) > 60 && (FIRST_REG) < 64)
-
-#undef GP_SAVE_INLINE
-#define GP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) > 29 && (FIRST_REG) < 32)
-
 /* Darwin uses a function call if everything needs to be saved/restored.  */
 
 #undef WORLD_SAVE_P