summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7.inc3
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.7/904-flatten-switch-stmt-00.patch76
2 files changed, 1 insertions, 78 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.7.inc b/meta/recipes-devtools/gcc/gcc-4.7.inc
index ece32c1546..43d77ecf07 100644
--- a/meta/recipes-devtools/gcc/gcc-4.7.inc
+++ b/meta/recipes-devtools/gcc/gcc-4.7.inc
@@ -1,6 +1,6 @@
1require gcc-common.inc 1require gcc-common.inc
2 2
3PR = "r6" 3PR = "r7"
4 4
5# Third digit in PV should be incremented after a minor release 5# Third digit in PV should be incremented after a minor release
6# happens from this branch on gcc e.g. currently its 4.7.1 6# happens from this branch on gcc e.g. currently its 4.7.1
@@ -52,7 +52,6 @@ SRC_URI = "git://github.com/mirrors/gcc.git;branch=${BRANCH};protocol=git \
52 file://306-libstdc++-namespace.patch \ 52 file://306-libstdc++-namespace.patch \
53 file://740-sh-pr24836.patch \ 53 file://740-sh-pr24836.patch \
54 file://800-arm-bigendian.patch \ 54 file://800-arm-bigendian.patch \
55 file://904-flatten-switch-stmt-00.patch \
56 file://arm-nolibfloat.patch \ 55 file://arm-nolibfloat.patch \
57 file://gcc-poison-system-directories.patch \ 56 file://gcc-poison-system-directories.patch \
58 file://gcc-poison-dir-extend.patch \ 57 file://gcc-poison-dir-extend.patch \
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/904-flatten-switch-stmt-00.patch b/meta/recipes-devtools/gcc/gcc-4.7/904-flatten-switch-stmt-00.patch
deleted file mode 100644
index e790e06dcb..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.7/904-flatten-switch-stmt-00.patch
+++ /dev/null
@@ -1,76 +0,0 @@
1Upstream-Status: Pending
2
3Hi,
4
5The attached patch makes sure that we create smaller object code for
6simple switch statements. We just make sure to flatten the switch
7statement into an if-else chain, basically.
8
9This fixes a size-regression as compared to gcc-3.4, as can be seen
10below.
11
122007-04-15 Bernhard Fischer <..>
13
14 * stmt.c (expand_case): Do not create a complex binary tree when
15 optimizing for size but rather use the simple ordered list.
16 (emit_case_nodes): do not emit jumps to the default_label when
17 optimizing for size.
18
19Not regtested so far.
20Comments?
21
22Attached is the test switch.c mentioned below.
23
24$ for i in 2.95 3.3 3.4 4.0 4.1 4.2.orig-HEAD 4.3.orig-HEAD 4.3-HEAD;do
25gcc-$i -DCHAIN -Os -o switch-CHAIN-$i.o -c switch.c ;done
26$ for i in 2.95 3.3 3.4 4.0 4.1 4.2.orig-HEAD 4.3.orig-HEAD 4.3-HEAD;do
27gcc-$i -UCHAIN -Os -o switch-$i.o -c switch.c ;done
28
29$ size switch-*.o
30 text data bss dec hex filename
31 169 0 0 169 a9 switch-2.95.o
32 115 0 0 115 73 switch-3.3.o
33 103 0 0 103 67 switch-3.4.o
34 124 0 0 124 7c switch-4.0.o
35 124 0 0 124 7c switch-4.1.o
36 124 0 0 124 7c switch-4.2.orig-HEAD.o
37 95 0 0 95 5f switch-4.3-HEAD.o
38 124 0 0 124 7c switch-4.3.orig-HEAD.o
39 166 0 0 166 a6 switch-CHAIN-2.95.o
40 111 0 0 111 6f switch-CHAIN-3.3.o
41 95 0 0 95 5f switch-CHAIN-3.4.o
42 95 0 0 95 5f switch-CHAIN-4.0.o
43 95 0 0 95 5f switch-CHAIN-4.1.o
44 95 0 0 95 5f switch-CHAIN-4.2.orig-HEAD.o
45 95 0 0 95 5f switch-CHAIN-4.3-HEAD.o
46 95 0 0 95 5f switch-CHAIN-4.3.orig-HEAD.o
47
48
49Content-Type: text/x-diff; charset=us-ascii
50Content-Disposition: attachment; filename="gcc-4.3.gcc-flatten-switch-stmt.00.diff"
51
52Index: gcc-4_7-branch/gcc/stmt.c
53===================================================================
54--- gcc-4_7-branch.orig/gcc/stmt.c 2012-04-10 10:19:49.095337065 -0700
55+++ gcc-4_7-branch/gcc/stmt.c 2012-04-10 10:32:52.219375048 -0700
56@@ -2397,7 +2397,11 @@
57 default code is emitted. */
58
59 use_cost_table = estimate_case_costs (case_list);
60- balance_case_nodes (&case_list, NULL);
61+ /* When optimizing for size, we want a straight list to avoid
62+ jumps as much as possible. This basically creates an if-else
63+ chain. */
64+ if (!optimize_size)
65+ balance_case_nodes (&case_list, NULL);
66 emit_case_nodes (index, case_list, default_label, index_type);
67 if (default_label)
68 emit_jump (default_label);
69@@ -2965,6 +2969,7 @@
70 {
71 if (!node_has_low_bound (node, index_type))
72 {
73+ if (!optimize_size) /* don't jl to the .default_label. */
74 emit_cmp_and_jump_insns (index,
75 convert_modes
76 (mode, imode,