On Mon, Nov 6, 2017 at 10:20 PM, H.J. Lu <[email protected]> wrote:
> When there is no need to make a copy of ix86_frame, we can use reference
> of struct ix86_frame to avoid copy.
>
> Tested on x86-64. OK for trunk?
>
>
> H.J.
> --
> * 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.
OK.
Thanks,
Uros.
> ---
> gcc/config/i386/i386.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
> index 0d5e2726a33..1e2709d8aec 100644
> --- a/gcc/config/i386/i386.c
> +++ b/gcc/config/i386/i386.c
> @@ -10486,8 +10486,6 @@ symbolic_reference_mentioned_p (rtx op)
> bool
> ix86_can_use_return_insn_p (void)
> {
> - struct ix86_frame frame;
> -
> if (ix86_function_naked (current_function_decl))
> return false;
>
> @@ -10502,7 +10500,7 @@ ix86_can_use_return_insn_p (void)
> if (crtl->args.pops_args && crtl->args.size >= 32768)
> return 0;
>
> - frame = cfun->machine->frame;
> + struct ix86_frame &frame = cfun->machine->frame;
> return (frame.stack_pointer_offset == UNITS_PER_WORD
> && (frame.nregs + frame.nsseregs) == 0);
> }
> @@ -10996,7 +10994,7 @@ ix86_can_eliminate (const int from, const int to)
> HOST_WIDE_INT
> ix86_initial_elimination_offset (int from, int to)
> {
> - 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;
> @@ -14334,7 +14332,6 @@ ix86_split_stack_guard (void)
> 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;
> @@ -14346,7 +14343,7 @@ ix86_expand_split_stack_prologue (void)
> gcc_assert (flag_split_stack && reload_completed);
>
> ix86_finalize_stack_frame_flags ();
> - 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
> --
> 2.13.6
>