summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-6.4/backport/0003-i386-Use-const-reference-of-struct-ix86_frame-to-avo.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-6.4/backport/0003-i386-Use-const-reference-of-struct-ix86_frame-to-avo.patch')
-rw-r--r--meta/recipes-devtools/gcc/gcc-6.4/backport/0003-i386-Use-const-reference-of-struct-ix86_frame-to-avo.patch131
1 files changed, 131 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-6.4/backport/0003-i386-Use-const-reference-of-struct-ix86_frame-to-avo.patch b/meta/recipes-devtools/gcc/gcc-6.4/backport/0003-i386-Use-const-reference-of-struct-ix86_frame-to-avo.patch
new file mode 100644
index 0000000000..a5ffd85d6f
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-6.4/backport/0003-i386-Use-const-reference-of-struct-ix86_frame-to-avo.patch
@@ -0,0 +1,131 @@
1From 82243732dc63e9b90396a5ae4ad99ca36af81355 Mon Sep 17 00:00:00 2001
2From: hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Sat, 27 Jan 2018 13:10:24 +0000
4Subject: [PATCH 03/12] i386: Use const reference of struct ix86_frame to avoid
5 copy
6
7We can use const reference of struct ix86_frame to avoid making a local
8copy of ix86_frame. ix86_expand_epilogue makes a local copy of struct
9ix86_frame and uses the reg_save_offset field as a local variable. This
10patch uses a separate local variable for reg_save_offset.
11
12Tested on x86-64 with ada.
13
14 Backport from mainline
15 PR target/83905
16 * config/i386/i386.c (ix86_expand_prologue): Use cost reference
17 of struct ix86_frame.
18 (ix86_expand_epilogue): Likewise. Add a local variable for
19 the reg_save_offset field in struct ix86_frame.
20
21git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@257123 138bc75d-0d04-0410-961f-82ee72b054a4
22
23Upstream-Status: Pending
24
25Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
26
27---
28 gcc/config/i386/i386.c | 24 ++++++++++++------------
29 1 file changed, 12 insertions(+), 12 deletions(-)
30
31diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
32index 13ebf10..6c98f75 100644
33--- a/gcc/config/i386/i386.c
34+++ b/gcc/config/i386/i386.c
35@@ -12633,7 +12633,6 @@ ix86_expand_prologue (void)
36 {
37 struct machine_function *m = cfun->machine;
38 rtx insn, t;
39- struct ix86_frame frame;
40 HOST_WIDE_INT allocate;
41 bool int_registers_saved;
42 bool sse_registers_saved;
43@@ -12657,7 +12656,7 @@ ix86_expand_prologue (void)
44 m->fs.sp_valid = true;
45
46 ix86_compute_frame_layout ();
47- frame = m->frame;
48+ const struct ix86_frame &frame = cfun->machine->frame;
49
50 if (!TARGET_64BIT && ix86_function_ms_hook_prologue (current_function_decl))
51 {
52@@ -13329,13 +13328,12 @@ ix86_expand_epilogue (int style)
53 {
54 struct machine_function *m = cfun->machine;
55 struct machine_frame_state frame_state_save = m->fs;
56- struct ix86_frame frame;
57 bool restore_regs_via_mov;
58 bool using_drap;
59
60 ix86_finalize_stack_realign_flags ();
61 ix86_compute_frame_layout ();
62- frame = m->frame;
63+ const struct ix86_frame &frame = cfun->machine->frame;
64
65 m->fs.sp_valid = (!frame_pointer_needed
66 || (crtl->sp_is_unchanging
67@@ -13377,11 +13375,13 @@ ix86_expand_epilogue (int style)
68 + UNITS_PER_WORD);
69 }
70
71+ HOST_WIDE_INT reg_save_offset = frame.reg_save_offset;
72+
73 /* Special care must be taken for the normal return case of a function
74 using eh_return: the eax and edx registers are marked as saved, but
75 not restored along this path. Adjust the save location to match. */
76 if (crtl->calls_eh_return && style != 2)
77- frame.reg_save_offset -= 2 * UNITS_PER_WORD;
78+ reg_save_offset -= 2 * UNITS_PER_WORD;
79
80 /* EH_RETURN requires the use of moves to function properly. */
81 if (crtl->calls_eh_return)
82@@ -13397,11 +13397,11 @@ ix86_expand_epilogue (int style)
83 else if (TARGET_EPILOGUE_USING_MOVE
84 && cfun->machine->use_fast_prologue_epilogue
85 && (frame.nregs > 1
86- || m->fs.sp_offset != frame.reg_save_offset))
87+ || m->fs.sp_offset != reg_save_offset))
88 restore_regs_via_mov = true;
89 else if (frame_pointer_needed
90 && !frame.nregs
91- && m->fs.sp_offset != frame.reg_save_offset)
92+ && m->fs.sp_offset != reg_save_offset)
93 restore_regs_via_mov = true;
94 else if (frame_pointer_needed
95 && TARGET_USE_LEAVE
96@@ -13439,7 +13439,7 @@ ix86_expand_epilogue (int style)
97 rtx t;
98
99 if (frame.nregs)
100- ix86_emit_restore_regs_using_mov (frame.reg_save_offset, style == 2);
101+ ix86_emit_restore_regs_using_mov (reg_save_offset, style == 2);
102
103 /* eh_return epilogues need %ecx added to the stack pointer. */
104 if (style == 2)
105@@ -13529,19 +13529,19 @@ ix86_expand_epilogue (int style)
106 epilogues. */
107 if (!m->fs.sp_valid
108 || (TARGET_SEH
109- && (m->fs.sp_offset - frame.reg_save_offset
110+ && (m->fs.sp_offset - reg_save_offset
111 >= SEH_MAX_FRAME_SIZE)))
112 {
113 pro_epilogue_adjust_stack (stack_pointer_rtx, hard_frame_pointer_rtx,
114 GEN_INT (m->fs.fp_offset
115- - frame.reg_save_offset),
116+ - reg_save_offset),
117 style, false);
118 }
119- else if (m->fs.sp_offset != frame.reg_save_offset)
120+ else if (m->fs.sp_offset != reg_save_offset)
121 {
122 pro_epilogue_adjust_stack (stack_pointer_rtx, stack_pointer_rtx,
123 GEN_INT (m->fs.sp_offset
124- - frame.reg_save_offset),
125+ - reg_save_offset),
126 style,
127 m->fs.cfa_reg == stack_pointer_rtx);
128 }
129--
1302.7.4
131