]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
i386: Use reference of struct ix86_frame to avoid copy
authorH.J. Lu <hongjiu.lu@intel.com>
Mon, 16 Apr 2018 18:43:57 +0000 (18:43 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Mon, 16 Apr 2018 18:43:57 +0000 (11:43 -0700)
When there is no need to make a copy of ix86_frame, we can use reference
of struct ix86_frame to avoid copy.

Backport from mainline
2017-11-06  H.J. Lu  <hongjiu.lu@intel.com>

* config/i386/i386.c (ix86_can_use_return_insn_p): Use reference
of struct ix86_frame.
(ix86_initial_elimination_offset): Likewise.
(ix86_expand_split_stack_prologue): Likewise.

From-SVN: r259410

gcc/ChangeLog
gcc/config/i386/i386.c

index eb06bd1693c3feda34e0864fd7511bfc92131d82..36da2d8b75cd574638bcc155d91b43e1ae2b14f5 100644 (file)
@@ -1,3 +1,13 @@
+2018-04-16  H.J. Lu  <hongjiu.lu@intel.com>
+
+       Backport from mainline
+       2017-11-06  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * config/i386/i386.c (ix86_can_use_return_insn_p): Use reference
+       of struct ix86_frame.
+       (ix86_initial_elimination_offset): Likewise.
+       (ix86_expand_split_stack_prologue): Likewise.
+
 2018-04-16  H.J. Lu  <hongjiu.lu@intel.com>
 
        Backport from mainline
index a1ff32b648ba653faccd10fa13cfe4692b39d71c..13ebf107e9023efa2f04af091e54fe254e7c6539 100644 (file)
@@ -10887,7 +10887,6 @@ symbolic_reference_mentioned_p (rtx op)
 bool
 ix86_can_use_return_insn_p (void)
 {
-  struct ix86_frame frame;
 
   if (! reload_completed || frame_pointer_needed)
     return 0;
@@ -10898,7 +10897,7 @@ ix86_can_use_return_insn_p (void)
     return 0;
 
   ix86_compute_frame_layout ();
-  frame = cfun->machine->frame;
+  struct ix86_frame &frame = cfun->machine->frame;
   return (frame.stack_pointer_offset == UNITS_PER_WORD
          && (frame.nregs + frame.nsseregs) == 0);
 }
@@ -11310,7 +11309,7 @@ HOST_WIDE_INT
 ix86_initial_elimination_offset (int from, int to)
 {
   ix86_compute_frame_layout ();
-  struct ix86_frame frame = cfun->machine->frame;
+  struct ix86_frame &frame = cfun->machine->frame;
 
   if (from == ARG_POINTER_REGNUM && to == HARD_FRAME_POINTER_REGNUM)
     return frame.hard_frame_pointer_offset;
@@ -13821,7 +13820,6 @@ static GTY(()) rtx split_stack_fn_large;
 void
 ix86_expand_split_stack_prologue (void)
 {
-  struct ix86_frame frame;
   HOST_WIDE_INT allocate;
   unsigned HOST_WIDE_INT args_size;
   rtx_code_label *label;
@@ -13834,7 +13832,7 @@ ix86_expand_split_stack_prologue (void)
 
   ix86_finalize_stack_realign_flags ();
   ix86_compute_frame_layout ();
-  frame = cfun->machine->frame;
+  struct ix86_frame &frame = cfun->machine->frame;
   allocate = frame.stack_pointer_offset - INCOMING_FRAME_SP_OFFSET;
 
   /* This is the label we will branch to if we have enough stack