summaryrefslogtreecommitdiffstats
path: root/toolchain-layer/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99339.patch
diff options
context:
space:
mode:
Diffstat (limited to 'toolchain-layer/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99339.patch')
-rw-r--r--toolchain-layer/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99339.patch236
1 files changed, 0 insertions, 236 deletions
diff --git a/toolchain-layer/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99339.patch b/toolchain-layer/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99339.patch
deleted file mode 100644
index f4a8e80ab7..0000000000
--- a/toolchain-layer/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99339.patch
+++ /dev/null
@@ -1,236 +0,0 @@
1 Backport from FSF mainline:
2
3 gcc/
4 * gengtype-lex.l: Add HARD_REG_SET.
5 * expr.c (expand_expr_real_1): Record writes to hard registers.
6 * function.h (rtl_data): Add asm_clobbers.
7 * ira.c (compute_regs_asm_clobbered): Use crtl->asm_clobbers.
8 (ira_setup_eliminable_regset): Remove regs_asm_clobbered.
9 Use crtl->asm_clobbers.
10
11 gcc/testsuite/
12 * gcc.target/arm/frame-pointer-1.c: New test.
13 * gcc.target/i386/pr9771-1.c: Move code out of main to allow frame
14 pointer elimination.
15
162010-07-26 Julian Brown <julian@codesourcery.com>
17
18 Merge from Sourcery G++ 4.4:
19
20 2009-06-23 Kazu Hirata <kazu@codesourcery.com>
21
22=== modified file 'gcc/expr.c'
23--- old/gcc/expr.c 2010-05-31 14:45:06 +0000
24+++ new/gcc/expr.c 2010-08-12 13:51:16 +0000
25@@ -8458,6 +8458,19 @@
26 expand_decl_rtl:
27 gcc_assert (decl_rtl);
28 decl_rtl = copy_rtx (decl_rtl);
29+ /* Record writes to register variables. */
30+ if (modifier == EXPAND_WRITE && REG_P (decl_rtl)
31+ && REGNO (decl_rtl) < FIRST_PSEUDO_REGISTER)
32+ {
33+ int i = REGNO (decl_rtl);
34+ int nregs = hard_regno_nregs[i][GET_MODE (decl_rtl)];
35+ while (nregs)
36+ {
37+ SET_HARD_REG_BIT (crtl->asm_clobbers, i);
38+ i++;
39+ nregs--;
40+ }
41+ }
42
43 /* Ensure variable marked as used even if it doesn't go through
44 a parser. If it hasn't be used yet, write out an external
45
46=== modified file 'gcc/function.h'
47--- old/gcc/function.h 2009-11-25 10:55:54 +0000
48+++ new/gcc/function.h 2010-08-12 13:51:16 +0000
49@@ -25,6 +25,7 @@
50 #include "tree.h"
51 #include "hashtab.h"
52 #include "vecprim.h"
53+#include "hard-reg-set.h"
54
55 /* Stack of pending (incomplete) sequences saved by `start_sequence'.
56 Each element describes one pending sequence.
57@@ -433,6 +434,12 @@
58 TREE_NOTHROW (current_function_decl) it is set even for overwritable
59 function where currently compiled version of it is nothrow. */
60 bool nothrow;
61+
62+ /* Like regs_ever_live, but 1 if a reg is set or clobbered from an
63+ asm. Unlike regs_ever_live, elements of this array corresponding
64+ to eliminable regs (like the frame pointer) are set if an asm
65+ sets them. */
66+ HARD_REG_SET asm_clobbers;
67 };
68
69 #define return_label (crtl->x_return_label)
70
71=== modified file 'gcc/gengtype-lex.l'
72--- old/gcc/gengtype-lex.l 2009-11-21 10:24:25 +0000
73+++ new/gcc/gengtype-lex.l 2010-08-12 13:51:16 +0000
74@@ -49,7 +49,7 @@
75 ID [[:alpha:]_][[:alnum:]_]*
76 WS [[:space:]]+
77 HWS [ \t\r\v\f]*
78-IWORD short|long|(un)?signed|char|int|HOST_WIDE_INT|HOST_WIDEST_INT|bool|size_t|BOOL_BITFIELD|CPPCHAR_SIGNED_T|ino_t|dev_t
79+IWORD short|long|(un)?signed|char|int|HOST_WIDE_INT|HOST_WIDEST_INT|bool|size_t|BOOL_BITFIELD|CPPCHAR_SIGNED_T|ino_t|dev_t|HARD_REG_SET
80 ITYPE {IWORD}({WS}{IWORD})*
81 EOID [^[:alnum:]_]
82
83
84=== modified file 'gcc/ira.c'
85--- old/gcc/ira.c 2010-03-31 01:44:10 +0000
86+++ new/gcc/ira.c 2010-08-12 13:51:16 +0000
87@@ -1385,14 +1385,12 @@
88 return for_each_rtx (&insn, insn_contains_asm_1, NULL);
89 }
90
91-/* Set up regs_asm_clobbered. */
92+/* Add register clobbers from asm statements. */
93 static void
94-compute_regs_asm_clobbered (char *regs_asm_clobbered)
95+compute_regs_asm_clobbered (void)
96 {
97 basic_block bb;
98
99- memset (regs_asm_clobbered, 0, sizeof (char) * FIRST_PSEUDO_REGISTER);
100-
101 FOR_EACH_BB (bb)
102 {
103 rtx insn;
104@@ -1413,7 +1411,7 @@
105 + hard_regno_nregs[dregno][mode] - 1;
106
107 for (i = dregno; i <= end; ++i)
108- regs_asm_clobbered[i] = 1;
109+ SET_HARD_REG_BIT(crtl->asm_clobbers, i);
110 }
111 }
112 }
113@@ -1425,12 +1423,6 @@
114 void
115 ira_setup_eliminable_regset (void)
116 {
117- /* Like regs_ever_live, but 1 if a reg is set or clobbered from an
118- asm. Unlike regs_ever_live, elements of this array corresponding
119- to eliminable regs (like the frame pointer) are set if an asm
120- sets them. */
121- char *regs_asm_clobbered
122- = (char *) alloca (FIRST_PSEUDO_REGISTER * sizeof (char));
123 #ifdef ELIMINABLE_REGS
124 int i;
125 static const struct {const int from, to; } eliminables[] = ELIMINABLE_REGS;
126@@ -1454,7 +1446,8 @@
127 COPY_HARD_REG_SET (ira_no_alloc_regs, no_unit_alloc_regs);
128 CLEAR_HARD_REG_SET (eliminable_regset);
129
130- compute_regs_asm_clobbered (regs_asm_clobbered);
131+ compute_regs_asm_clobbered ();
132+
133 /* Build the regset of all eliminable registers and show we can't
134 use those that we already know won't be eliminated. */
135 #ifdef ELIMINABLE_REGS
136@@ -1464,7 +1457,7 @@
137 = (! targetm.can_eliminate (eliminables[i].from, eliminables[i].to)
138 || (eliminables[i].to == STACK_POINTER_REGNUM && need_fp));
139
140- if (! regs_asm_clobbered[eliminables[i].from])
141+ if (!TEST_HARD_REG_BIT (crtl->asm_clobbers, eliminables[i].from))
142 {
143 SET_HARD_REG_BIT (eliminable_regset, eliminables[i].from);
144
145@@ -1478,7 +1471,7 @@
146 df_set_regs_ever_live (eliminables[i].from, true);
147 }
148 #if FRAME_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
149- if (! regs_asm_clobbered[HARD_FRAME_POINTER_REGNUM])
150+ if (!TEST_HARD_REG_BIT (crtl->asm_clobbers, HARD_FRAME_POINTER_REGNUM))
151 {
152 SET_HARD_REG_BIT (eliminable_regset, HARD_FRAME_POINTER_REGNUM);
153 if (need_fp)
154@@ -1492,7 +1485,7 @@
155 #endif
156
157 #else
158- if (! regs_asm_clobbered[FRAME_POINTER_REGNUM])
159+ if (!TEST_HARD_REG_BIT (crtl->asm_clobbers, HARD_FRAME_POINTER_REGNUM))
160 {
161 SET_HARD_REG_BIT (eliminable_regset, FRAME_POINTER_REGNUM);
162 if (need_fp)
163
164=== added file 'gcc/testsuite/gcc.target/arm/frame-pointer-1.c'
165--- old/gcc/testsuite/gcc.target/arm/frame-pointer-1.c 1970-01-01 00:00:00 +0000
166+++ new/gcc/testsuite/gcc.target/arm/frame-pointer-1.c 2010-08-12 13:51:16 +0000
167@@ -0,0 +1,42 @@
168+/* Check local register variables using a register conventionally
169+ used as the frame pointer aren't clobbered under high register pressure. */
170+/* { dg-do run } */
171+/* { dg-options "-Os -mthumb -fomit-frame-pointer" } */
172+
173+#include <stdlib.h>
174+
175+int global=5;
176+
177+void __attribute__((noinline)) foo(int p1, int p2, int p3, int p4)
178+{
179+ if (global != 5 || p1 != 1 || p2 != 2 || p3 != 3 || p4 != 4)
180+ abort();
181+}
182+
183+int __attribute__((noinline)) test(int a, int b, int c, int d)
184+{
185+ register unsigned long r __asm__("r7") = 0xdeadbeef;
186+ int e;
187+
188+ /* ABCD are live after the call which should be enough
189+ to cause r7 to be used if it weren't for the register variable. */
190+ foo(a,b,c,d);
191+
192+ e = 0;
193+ __asm__ __volatile__ ("mov %0, %2"
194+ : "=r" (e)
195+ : "0" (e), "r" (r));
196+
197+ global = a+b+c+d;
198+
199+ return e;
200+}
201+
202+int main()
203+{
204+ if (test(1, 2, 3, 4) != 0xdeadbeef)
205+ abort();
206+ if (global != 10)
207+ abort();
208+ return 0;
209+}
210
211=== modified file 'gcc/testsuite/gcc.target/i386/pr9771-1.c'
212--- old/gcc/testsuite/gcc.target/i386/pr9771-1.c 2007-08-22 08:59:14 +0000
213+++ new/gcc/testsuite/gcc.target/i386/pr9771-1.c 2010-08-12 13:51:16 +0000
214@@ -28,7 +28,10 @@
215 *adr = save;
216 }
217
218-int main()
219+/* This must not be inlined becuase main() requires the frame pointer
220+ for stack alignment. */
221+void test(void) __attribute__((noinline));
222+void test(void)
223 {
224 B = &x;
225
226@@ -42,3 +45,9 @@
227 exit(0);
228 }
229
230+int main()
231+{
232+ test();
233+ return 0;
234+
235+}
236