-
Notifications
You must be signed in to change notification settings - Fork 180
/
0008-xtensa-move-callee-saved-register-check-to-xtensa_ca.patch
70 lines (59 loc) · 2.18 KB
/
0008-xtensa-move-callee-saved-register-check-to-xtensa_ca.patch
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
From 2f60e5db550a287c58e6e69d993946818d01159c Mon Sep 17 00:00:00 2001
From: Max Filippov <jcmvbkbc@gmail.com>
Date: Sun, 9 Nov 2014 06:24:08 +0300
Subject: [PATCH 08/16] xtensa: move callee-saved register check to
xtensa_call_save_reg
Don't reserve extra stack space with windowed ABI. Save A0 when
profiling is enabled.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
gcc/config/xtensa/xtensa.c | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
index 29dc603..e5dc8db 100644
--- a/gcc/config/xtensa/xtensa.c
+++ b/gcc/config/xtensa/xtensa.c
@@ -2585,6 +2585,18 @@ xtensa_output_literal (FILE *file, rtx x, enum machine_mode mode, int labelno)
}
}
+static bool
+xtensa_call_save_reg(int regno)
+{
+ if (TARGET_WINDOWED_ABI)
+ return false;
+
+ if (regno == A0_REG)
+ return crtl->profile || df_regs_ever_live_p (regno);
+
+ return !fixed_regs[regno] && !call_used_regs[regno] &&
+ df_regs_ever_live_p (regno);
+}
/* Return the bytes needed to compute the frame pointer from the current
stack pointer. */
@@ -2604,8 +2616,7 @@ compute_frame_size (int size)
xtensa_callee_save_size = 0;
for (regno = 0; regno < FIRST_PSEUDO_REGISTER; ++regno)
{
- if ((regno == A0_REG || (!fixed_regs[regno] && !call_used_regs[regno])) &&
- df_regs_ever_live_p (regno))
+ if (xtensa_call_save_reg(regno))
xtensa_callee_save_size += UNITS_PER_WORD;
}
@@ -2691,8 +2702,7 @@ xtensa_expand_prologue (void)
for (regno = 0; regno < FIRST_PSEUDO_REGISTER; ++regno)
{
- if ((regno == A0_REG || (!fixed_regs[regno] && !call_used_regs[regno])) &&
- df_regs_ever_live_p (regno))
+ if (xtensa_call_save_reg(regno))
{
rtx x = gen_rtx_PLUS (Pmode, stack_pointer_rtx, GEN_INT (offset));
@@ -2779,8 +2789,7 @@ xtensa_expand_epilogue (void)
for (regno = 0; regno < FIRST_PSEUDO_REGISTER; ++regno)
{
- if ((regno == A0_REG || (!fixed_regs[regno] && !call_used_regs[regno])) &&
- df_regs_ever_live_p (regno))
+ if (xtensa_call_save_reg(regno))
{
rtx x = gen_rtx_PLUS (Pmode, stack_pointer_rtx, GEN_INT (offset));
--
1.8.1.4