public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Burgess <andrew.burgess@embecosm.com>
To: Claudiu Zissulescu <Claudiu.Zissulescu@synopsys.com>
Cc: gcc-patches@gcc.gnu.org, Francois.Bedard@synopsys.com,
	Claudiu Zissulescu <claziss@gmail.com>
Subject: Re: [PATCH 6/7] [ARC] Prevent moving stores to the frame before the stack adjustment.
Date: Wed, 31 May 2017 16:40:00 -0000	[thread overview]
Message-ID: <20170531163313.GI25719@embecosm.com> (raw)
In-Reply-To: <1495189862-20533-7-git-send-email-claziss@synopsys.com>

* Claudiu Zissulescu <Claudiu.Zissulescu@synopsys.com> [2017-05-19 12:31:01 +0200]:

> From: Claudiu Zissulescu <claziss@gmail.com>
> 
> If the stack pointer is needed, emit a special barrier that will prevent
> the scheduler from moving stores to the frame before the stack adjustment.
> 
> 2017-01-03  Claudiu Zissulescu  <claziss@synopsys.com>
> 
> 	* config/arc/arc.c (arc_expand_prologue): Emit a special barrier
> 	to prevent store reordering.
> 	* config/arc/arc.md (UNSPEC_ARC_STKTIE): Define.
> 	(type): Add block type.
> 	(stack_tie): Define special instruction to be used in
> 	expand_prologue.

Given the description the code looks fine.  It would be nice to see
more of a _why_ in the commit message.  I'm guessing this is either
something related to signal handling, or debugging... I don't see why
this would be needed for functional correctness.

Thanks,
Andrew






> ---
>  gcc/config/arc/arc.c  | 10 +++++++++-
>  gcc/config/arc/arc.md | 15 ++++++++++++++-
>  2 files changed, 23 insertions(+), 2 deletions(-)
> 
> diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
> index ff86f6c..0c4c901 100644
> --- a/gcc/config/arc/arc.c
> +++ b/gcc/config/arc/arc.c
> @@ -3030,7 +3030,15 @@ arc_expand_prologue (void)
>    frame_size_to_allocate -= first_offset;
>    /* Allocate the stack frame.  */
>    if (frame_size_to_allocate > 0)
> -    frame_stack_add ((HOST_WIDE_INT) 0 - frame_size_to_allocate);
> +    {
> +      frame_stack_add ((HOST_WIDE_INT) 0 - frame_size_to_allocate);
> +      /* If the frame pointer is needed, emit a special barrier that
> +	 will prevent the scheduler from moving stores to the frame
> +	 before the stack adjustment.  */
> +      if (arc_frame_pointer_needed ())
> +	emit_insn (gen_stack_tie (stack_pointer_rtx,
> +				  hard_frame_pointer_rtx));
> +    }
>  
>    /* Setup the gp register, if needed.  */
>    if (crtl->uses_pic_offset_table)
> diff --git a/gcc/config/arc/arc.md b/gcc/config/arc/arc.md
> index 743a844..6cd192a 100644
> --- a/gcc/config/arc/arc.md
> +++ b/gcc/config/arc/arc.md
> @@ -135,6 +135,7 @@
>    UNSPEC_ARC_VMAC2HU
>    UNSPEC_ARC_VMPY2H
>    UNSPEC_ARC_VMPY2HU
> +  UNSPEC_ARC_STKTIE
>    ])
>  
>  (define_c_enum "vunspec" [
> @@ -205,7 +206,7 @@
>     simd_vcompare, simd_vpermute, simd_vpack, simd_vpack_with_acc,
>     simd_valign, simd_valign_with_acc, simd_vcontrol,
>     simd_vspecial_3cycle, simd_vspecial_4cycle, simd_dma, mul16_em, div_rem,
> -   fpu"
> +   fpu, block"
>    (cond [(eq_attr "is_sfunc" "yes")
>  	 (cond [(match_test "!TARGET_LONG_CALLS_SET && (!TARGET_MEDIUM_CALLS || GET_CODE (PATTERN (insn)) != COND_EXEC)") (const_string "call")
>  		(match_test "flag_pic") (const_string "sfunc")]
> @@ -6547,6 +6548,18 @@
>    (set_attr "predicable" "yes,no,no,yes,no")
>    (set_attr "cond" "canuse,nocond,nocond,canuse_limm,nocond")])
>  
> +(define_insn "stack_tie"
> +  [(set (mem:BLK (scratch))
> +	(unspec:BLK [(match_operand:SI 0 "register_operand" "rb")
> +		     (match_operand:SI 1 "register_operand" "rb")]
> +		    UNSPEC_ARC_STKTIE))]
> +  ""
> +  ""
> +  [(set_attr "length" "0")
> +   (set_attr "iscompact" "false")
> +   (set_attr "type" "block")]
> +  )
> +
>  ;; include the arc-FPX instructions
>  (include "fpx.md")
>  
> -- 
> 1.9.1
> 

  reply	other threads:[~2017-05-31 16:33 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-19 10:34 [PATCH 0/7] [ARC] Patterns update and fixes Claudiu Zissulescu
2017-05-19 10:34 ` [PATCH 1/7] [ARC] Make mulsi for A700 pattern commutative Claudiu Zissulescu
2017-05-20  7:49   ` Andrew Burgess
2017-06-01  9:49     ` Claudiu Zissulescu
2017-05-19 10:34 ` [PATCH 4/7] [ARC] Change predicate movv2hi to avoid scaled addresses Claudiu Zissulescu
2017-05-31 15:36   ` Andrew Burgess
2017-06-01  9:47     ` Claudiu Zissulescu
2017-05-19 10:34 ` [PATCH 5/7] [ARC] Update (non)commutative_binary_comparison patterns Claudiu Zissulescu
2017-05-31 15:40   ` Andrew Burgess
2017-06-01  9:46     ` Claudiu Zissulescu
2017-05-19 10:34 ` [PATCH 6/7] [ARC] Prevent moving stores to the frame before the stack adjustment Claudiu Zissulescu
2017-05-31 16:40   ` Andrew Burgess [this message]
2017-06-01  8:30     ` Claudiu Zissulescu
2017-06-01  9:45     ` Claudiu Zissulescu
2017-05-19 10:34 ` [PATCH 7/7] [ARC] Test against frame_pointer_needed in arc_can_eliminate Claudiu Zissulescu
2017-05-31 16:28   ` Andrew Burgess
2017-06-01  9:46     ` Claudiu Zissulescu
2017-05-19 10:34 ` [PATCH 2/7] [ARC] Avoid use of hard registers before reg-alloc Claudiu Zissulescu
2017-05-31 14:52   ` Andrew Burgess
2017-06-01  9:48     ` Claudiu Zissulescu
2017-05-19 10:35 ` [PATCH 3/7] [ARC] Allow r30 to be used by the reg-alloc Claudiu Zissulescu
2017-05-31 15:10   ` Andrew Burgess
2017-06-01  9:47     ` Claudiu Zissulescu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170531163313.GI25719@embecosm.com \
    --to=andrew.burgess@embecosm.com \
    --cc=Claudiu.Zissulescu@synopsys.com \
    --cc=Francois.Bedard@synopsys.com \
    --cc=claziss@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).