From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25500 invoked by alias); 19 May 2017 10:34:02 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 25340 invoked by uid 89); 19 May 2017 10:34:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-23.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: smtprelay.synopsys.com Received: from smtprelay.synopsys.com (HELO smtprelay.synopsys.com) (198.182.60.111) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 19 May 2017 10:33:59 +0000 Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id ABAAF10C123B; Fri, 19 May 2017 03:34:01 -0700 (PDT) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 89660953; Fri, 19 May 2017 03:34:01 -0700 (PDT) Received: from us01wehtc1.internal.synopsys.com (us01wehtc1-vip.internal.synopsys.com [10.12.239.236]) by mailhost.synopsys.com (Postfix) with ESMTP id 5B57894B; Fri, 19 May 2017 03:34:01 -0700 (PDT) Received: from IN01WEHTCB.internal.synopsys.com (10.144.199.106) by us01wehtc1.internal.synopsys.com (10.12.239.231) with Microsoft SMTP Server (TLS) id 14.3.266.1; Fri, 19 May 2017 03:34:01 -0700 Received: from IN01WEHTCA.internal.synopsys.com (10.144.199.103) by IN01WEHTCB.internal.synopsys.com (10.144.199.105) with Microsoft SMTP Server (TLS) id 14.3.266.1; Fri, 19 May 2017 16:03:59 +0530 Received: from nl20droid1.internal.synopsys.com (10.100.24.228) by IN01WEHTCA.internal.synopsys.com (10.144.199.243) with Microsoft SMTP Server (TLS) id 14.3.266.1; Fri, 19 May 2017 16:03:59 +0530 From: Claudiu Zissulescu To: CC: , , , Claudiu Zissulescu Subject: [PATCH 6/7] [ARC] Prevent moving stores to the frame before the stack adjustment. Date: Fri, 19 May 2017 10:34:00 -0000 Message-ID: <1495189862-20533-7-git-send-email-claziss@synopsys.com> In-Reply-To: <1495189862-20533-1-git-send-email-claziss@synopsys.com> References: <1495189862-20533-1-git-send-email-claziss@synopsys.com> MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2017-05/txt/msg01535.txt.bz2 From: Claudiu Zissulescu 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 * 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. --- 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