summaryrefslogtreecommitdiffstats
path: root/bsp/meta-synopsys/recipes-devtools/gcc/gcc-arc/0041-ARC-Emit-blockage-regardless-to-avoid-delay-slot-sch.patch
blob: dfdc4f1602da97457fbcbf271c72f25d048d2423 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
From bda19efc40252dff9bf25ec3ca63bb968fb7fa4a Mon Sep 17 00:00:00 2001
From: Claudiu Zissulescu <claziss@gmail.com>
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  <claziss@synopsys.com>

	* 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 <abrodkin@synopsys.com>
---
 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