From 9f8760ed72603aa2abdbf5b83f74cc5737da2a43 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Mon, 6 Nov 2017 23:04:15 +0000 Subject: [PATCH] i386: Use reference of struct ix86_frame to avoid copy 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. * 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: r254480 --- gcc/ChangeLog | 7 +++++++ gcc/config/i386/i386.c | 9 +++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b904b17b624..9353fd3586d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-11-06 H.J. Lu + + * 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. + 2017-11-06 Marc Glisse * tree-vrp.h (enum value_range_type): Update stale comment. 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.30.2