Skip to content

Commit 46b6621

Browse files
committed
Update RISC-V GCC 8.3
Pull in fixes from https://github.com/riscv/riscv-gcc/commits/riscv-gcc-8.3.0 Signed-off-by: Kumar Gala <[email protected]>
1 parent 06d9a64 commit 46b6621

20 files changed

+10327
-0
lines changed
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
From 1660664ab806bad90af096cd74717bdb18407f70 Mon Sep 17 00:00:00 2001
2+
From: wilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
3+
Date: Sat, 17 Nov 2018 23:31:01 +0000
4+
Subject: [PATCH 23/42] RISC-V: Fix epilogue unwind info with fp and single sp
5+
adjust.
6+
7+
gcc/
8+
* config/riscv/riscv.c (epilogue_cfa_sp_offset): New.
9+
(riscv_restore_reg): If restoring HARD_FRAME_POINTER_REGNUM, and
10+
epilogue_cfa_sp_offset set, then add REG_CFA_DEF_CFA regnote.
11+
(riscv_expand_epilogue): Initialize epilogue_cfa_sp_offset. Set it
12+
to step2 if frame_pointer_needed and step1 is 0.
13+
14+
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@266241 138bc75d-0d04-0410-961f-82ee72b054a4
15+
---
16+
gcc/ChangeLog | 8 ++++++++
17+
gcc/config/riscv/riscv.c | 23 ++++++++++++++++++++++-
18+
2 files changed, 30 insertions(+), 1 deletion(-)
19+
20+
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
21+
index ee9a790fa47..5b61aee9b1b 100644
22+
--- a/gcc/ChangeLog
23+
+++ b/gcc/ChangeLog
24+
@@ -1,3 +1,11 @@
25+
+2018-11-17 Jim Wilson <[email protected]>
26+
+
27+
+ * config/riscv/riscv.c (epilogue_cfa_sp_offset): New.
28+
+ (riscv_restore_reg): If restoring HARD_FRAME_POINTER_REGNUM, and
29+
+ epilogue_cfa_sp_offset set, then add REG_CFA_DEF_CFA regnote.
30+
+ (riscv_expand_epilogue): Initialize epilogue_cfa_sp_offset. Set it
31+
+ to step2 if frame_pointer_needed and step1 is 0.
32+
+
33+
2018-10-05 Andrew Waterman <[email protected]>
34+
Jim Wilson <[email protected]>
35+
36+
diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c
37+
index 76bb74fb2d4..c0a9557638e 100644
38+
--- a/gcc/config/riscv/riscv.c
39+
+++ b/gcc/config/riscv/riscv.c
40+
@@ -237,6 +237,11 @@ bool riscv_slow_unaligned_access_p;
41+
/* Stack alignment to assume/maintain. */
42+
unsigned riscv_stack_boundary;
43+
44+
+/* If non-zero, this is an offset to be added to SP to redefine the CFA
45+
+ when restoring the FP register from the stack. Only valid when generating
46+
+ the epilogue. */
47+
+static int epilogue_cfa_sp_offset;
48+
+
49+
/* Which tuning parameters to use. */
50+
static const struct riscv_tune_info *tune_info;
51+
52+
@@ -3621,8 +3626,15 @@ riscv_restore_reg (rtx reg, rtx mem)
53+
rtx insn = riscv_emit_move (reg, mem);
54+
rtx dwarf = NULL_RTX;
55+
dwarf = alloc_reg_note (REG_CFA_RESTORE, reg, dwarf);
56+
- REG_NOTES (insn) = dwarf;
57+
58+
+ if (epilogue_cfa_sp_offset && REGNO (reg) == HARD_FRAME_POINTER_REGNUM)
59+
+ {
60+
+ rtx cfa_adjust_rtx = gen_rtx_PLUS (Pmode, stack_pointer_rtx,
61+
+ GEN_INT (epilogue_cfa_sp_offset));
62+
+ dwarf = alloc_reg_note (REG_CFA_DEF_CFA, cfa_adjust_rtx, dwarf);
63+
+ }
64+
+
65+
+ REG_NOTES (insn) = dwarf;
66+
RTX_FRAME_RELATED_P (insn) = 1;
67+
}
68+
69+
@@ -3871,6 +3883,9 @@ riscv_expand_epilogue (int style)
70+
return;
71+
}
72+
73+
+ /* Reset the epilogue cfa info before starting to emit the epilogue. */
74+
+ epilogue_cfa_sp_offset = 0;
75+
+
76+
/* Move past any dynamic stack allocations. */
77+
if (cfun->calls_alloca)
78+
{
79+
@@ -3935,6 +3950,12 @@ riscv_expand_epilogue (int style)
80+
81+
REG_NOTES (insn) = dwarf;
82+
}
83+
+ else if (frame_pointer_needed)
84+
+ {
85+
+ /* Tell riscv_restore_reg to emit dwarf to redefine CFA when restoring
86+
+ old value of FP. */
87+
+ epilogue_cfa_sp_offset = step2;
88+
+ }
89+
90+
if (use_restore_libcall)
91+
frame->mask = 0; /* Temporarily fib that we need not save GPRs. */
92+
--
93+
2.20.1
94+

0 commit comments

Comments
 (0)