aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorH.J. Lu <hongjiu.lu@intel.com>2018-01-23 19:30:32 +0000
committerH.J. Lu <hjl@gcc.gnu.org>2018-01-23 11:30:32 -0800
commit56dbd05b0ed265ec37f66234487aaad6e330c7ce (patch)
tree8753b6e58fcf8b59cdc63f9748f6f99d97c1b9dd /gcc
parentf59986b285e3dff07f847c5a680f6f9e0b9520f0 (diff)
downloadgcc-56dbd05b0ed265ec37f66234487aaad6e330c7ce.zip
gcc-56dbd05b0ed265ec37f66234487aaad6e330c7ce.tar.gz
gcc-56dbd05b0ed265ec37f66234487aaad6e330c7ce.tar.bz2
i386: Use const reference of struct ix86_frame to avoid copy
We can use const reference of struct ix86_frame to avoid making a local copy of ix86_frame. ix86_expand_epilogue makes a local copy of struct ix86_frame and uses the reg_save_offset field as a local variable. This patch uses a separate local variable for reg_save_offset. Tested on x86-64 with ada. PR target/83905 * config/i386/i386.c (ix86_expand_prologue): Use cost reference of struct ix86_frame. (ix86_expand_epilogue): Likewise. Add a local variable for the reg_save_offset field in struct ix86_frame. From-SVN: r256996
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config/i386/i386.c24
2 files changed, 20 insertions, 12 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 576d5a2..04de554 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2018-01-23 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/83905
+ * config/i386/i386.c (ix86_expand_prologue): Use cost reference
+ of struct ix86_frame.
+ (ix86_expand_epilogue): Likewise. Add a local variable for
+ the reg_save_offset field in struct ix86_frame.
+
2018-01-23 Bin Cheng <bin.cheng@arm.com>
PR tree-optimization/82604
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 72d25ae4..101fea6 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -13376,7 +13376,6 @@ ix86_expand_prologue (void)
{
struct machine_function *m = cfun->machine;
rtx insn, t;
- struct ix86_frame frame;
HOST_WIDE_INT allocate;
bool int_registers_saved;
bool sse_registers_saved;
@@ -13404,7 +13403,7 @@ ix86_expand_prologue (void)
m->fs.sp_valid = true;
m->fs.sp_realigned = false;
- frame = m->frame;
+ const struct ix86_frame &frame = cfun->machine->frame;
if (!TARGET_64BIT && ix86_function_ms_hook_prologue (current_function_decl))
{
@@ -14282,7 +14281,6 @@ ix86_expand_epilogue (int style)
{
struct machine_function *m = cfun->machine;
struct machine_frame_state frame_state_save = m->fs;
- struct ix86_frame frame;
bool restore_regs_via_mov;
bool using_drap;
bool restore_stub_is_tail = false;
@@ -14295,7 +14293,7 @@ ix86_expand_epilogue (int style)
}
ix86_finalize_stack_frame_flags ();
- frame = m->frame;
+ const struct ix86_frame &frame = cfun->machine->frame;
m->fs.sp_realigned = stack_realign_fp;
m->fs.sp_valid = stack_realign_fp
@@ -14339,11 +14337,13 @@ ix86_expand_epilogue (int style)
+ UNITS_PER_WORD);
}
+ HOST_WIDE_INT reg_save_offset = frame.reg_save_offset;
+
/* Special care must be taken for the normal return case of a function
using eh_return: the eax and edx registers are marked as saved, but
not restored along this path. Adjust the save location to match. */
if (crtl->calls_eh_return && style != 2)
- frame.reg_save_offset -= 2 * UNITS_PER_WORD;
+ reg_save_offset -= 2 * UNITS_PER_WORD;
/* EH_RETURN requires the use of moves to function properly. */
if (crtl->calls_eh_return)
@@ -14359,11 +14359,11 @@ ix86_expand_epilogue (int style)
else if (TARGET_EPILOGUE_USING_MOVE
&& cfun->machine->use_fast_prologue_epilogue
&& (frame.nregs > 1
- || m->fs.sp_offset != frame.reg_save_offset))
+ || m->fs.sp_offset != reg_save_offset))
restore_regs_via_mov = true;
else if (frame_pointer_needed
&& !frame.nregs
- && m->fs.sp_offset != frame.reg_save_offset)
+ && m->fs.sp_offset != reg_save_offset)
restore_regs_via_mov = true;
else if (frame_pointer_needed
&& TARGET_USE_LEAVE
@@ -14431,7 +14431,7 @@ ix86_expand_epilogue (int style)
rtx t;
if (frame.nregs)
- ix86_emit_restore_regs_using_mov (frame.reg_save_offset, style == 2);
+ ix86_emit_restore_regs_using_mov (reg_save_offset, style == 2);
/* eh_return epilogues need %ecx added to the stack pointer. */
if (style == 2)
@@ -14526,19 +14526,19 @@ ix86_expand_epilogue (int style)
in epilogues. */
if (!m->fs.sp_valid || m->fs.sp_realigned
|| (TARGET_SEH
- && (m->fs.sp_offset - frame.reg_save_offset
+ && (m->fs.sp_offset - reg_save_offset
>= SEH_MAX_FRAME_SIZE)))
{
pro_epilogue_adjust_stack (stack_pointer_rtx, hard_frame_pointer_rtx,
GEN_INT (m->fs.fp_offset
- - frame.reg_save_offset),
+ - reg_save_offset),
style, false);
}
- else if (m->fs.sp_offset != frame.reg_save_offset)
+ else if (m->fs.sp_offset != reg_save_offset)
{
pro_epilogue_adjust_stack (stack_pointer_rtx, stack_pointer_rtx,
GEN_INT (m->fs.sp_offset
- - frame.reg_save_offset),
+ - reg_save_offset),
style,
m->fs.cfa_reg == stack_pointer_rtx);
}