From bda19efc40252dff9bf25ec3ca63bb968fb7fa4a Mon Sep 17 00:00:00 2001 From: Claudiu Zissulescu Date: Wed, 16 Jan 2019 13:16:09 +0200 Subject: [PATCH] [ARC] Emit blockage regardless to avoid delay slot scheduling. The delay slot scheduler can reschedule some of the frame related instructions resulting in having incorect CFI information. This patch introduces a schedule blockage to avoid this problem. gcc/ xxxx-xx-xx Claudiu Zissulescu * config/arc/arc.c (arc_expand_prologue): Emit blockage regardless to avoid delay slot scheduling. * config/arc/arc.md (stack_tie): Remove. (UNSPEC_ARC_STKTIE): Likewise. Upstream status: Pending Signed-off-by: Alexey Brodkin --- gcc/config/arc/arc.c | 12 ++++-------- gcc/config/arc/arc.md | 13 ------------- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c index 88b76a2e94b..7b201d3f64c 100644 --- a/gcc/config/arc/arc.c +++ b/gcc/config/arc/arc.c @@ -3716,14 +3716,10 @@ arc_expand_prologue (void) /* Allocate the stack frame. */ if (frame_size_to_allocate > 0) - { - 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)); - } + frame_stack_add ((HOST_WIDE_INT) 0 - frame_size_to_allocate); + + /* Emit a blockage to avoid delay slot scheduling. */ + emit_insn (gen_blockage ()); } /* Do any necessary cleanup after a function to restore stack, frame, diff --git a/gcc/config/arc/arc.md b/gcc/config/arc/arc.md index f2313fc49f2..a3ec6a41ac2 100644 --- a/gcc/config/arc/arc.md +++ b/gcc/config/arc/arc.md @@ -136,7 +136,6 @@ UNSPEC_ARC_VMAC2HU UNSPEC_ARC_VMPY2H UNSPEC_ARC_VMPY2HU - UNSPEC_ARC_STKTIE VUNSPEC_ARC_RTIE VUNSPEC_ARC_SYNC @@ -6283,18 +6282,6 @@ core_3, archs4x, archs4xd, archs4xd_slow" (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" "r") - (match_operand:SI 1 "register_operand" "r")] - UNSPEC_ARC_STKTIE))] - "" - "" - [(set_attr "length" "0") - (set_attr "iscompact" "false") - (set_attr "type" "block")] - ) - (define_insn "*add_shift" [(set (match_operand:SI 0 "register_operand" "=q,r,r") (plus:SI (ashift:SI (match_operand:SI 1 "register_operand" "q,r,r") -- 2.16.2