blob: 41c90353bad1fd18511ce1ec3c816b4e97b0c917 [file] [log] [blame]
Andrew Geissler84ad7c52020-06-27 00:00:16 -05001From 5f54efe1e7d9604b45ddddd510ce439477d0e94f Mon Sep 17 00:00:00 2001
2From: Nagaraju <nmekala@xilinx.com>
3Date: Thu, 9 Jan 2020 12:30:41 +0530
4Subject: [PATCH] [Patch, microblaze]: Fix Compiler crash with
5 -freg-struct-return This patch fixes a bug in MB GCC regarding the passing
6 struct values in registers. Currently we are only handling SImode With this
7 patch all other modes are handled properly
8
9Signed-off-by :Nagaraju Mekala <nmekala@xilix.com>
10
11---
12 gcc/config/microblaze/microblaze.c | 11 ++++++++++-
13 gcc/config/microblaze/microblaze.h | 19 -------------------
14 2 files changed, 10 insertions(+), 20 deletions(-)
15
16diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c
17index 5c09452..beccd12 100644
18--- a/gcc/config/microblaze/microblaze.c
19+++ b/gcc/config/microblaze/microblaze.c
20@@ -4046,7 +4046,16 @@ microblaze_function_value (const_tree valtype,
21 const_tree func ATTRIBUTE_UNUSED,
22 bool outgoing ATTRIBUTE_UNUSED)
23 {
24- return LIBCALL_VALUE (TYPE_MODE (valtype));
25+ return gen_rtx_REG (TYPE_MODE (valtype), GP_RETURN);
26+}
27+
28+#undef TARGET_LIBCALL_VALUE
29+#define TARGET_LIBCALL_VALUE microblaze_libcall_value
30+
31+rtx
32+microblaze_libcall_value (machine_mode mode, const_rtx fun ATTRIBUTE_UNUSED)
33+{
34+ return gen_rtx_REG (mode, GP_RETURN);
35 }
36
37 /* Implement TARGET_SCHED_ADJUST_COST. */
38diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
39index ab541f7..100e7b2 100644
40--- a/gcc/config/microblaze/microblaze.h
41+++ b/gcc/config/microblaze/microblaze.h
42@@ -266,13 +266,6 @@ extern enum pipeline_type microblaze_pipe;
43
44 #define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
45
46-#ifndef __arch64__
47-#define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \
48- if (GET_MODE_CLASS (MODE) == MODE_INT \
49- && GET_MODE_SIZE (MODE) < 4) \
50- (MODE) = SImode;
51-#endif
52-
53 /* Standard register usage. */
54
55 /* On the MicroBlaze, we have 32 integer registers */
56@@ -471,18 +464,6 @@ extern struct microblaze_frame_info current_frame_info;
57
58 #define MAX_ARGS_IN_REGISTERS MB_ABI_MAX_ARG_REGS
59
60-#ifdef __aarch64__
61-#define LIBCALL_VALUE(MODE) \
62- gen_rtx_REG (MODE,GP_RETURN)
63-#else
64-#define LIBCALL_VALUE(MODE) \
65- gen_rtx_REG ( \
66- ((GET_MODE_CLASS (MODE) != MODE_INT \
67- || GET_MODE_SIZE (MODE) >= 4) \
68- ? (MODE) \
69- : SImode), GP_RETURN)
70-#endif
71-
72 /* 1 if N is a possible register number for a function value.
73 On the MicroBlaze, R2 R3 are the only register thus used.
74 Currently, R2 are only implemented here (C has no complex type) */
75--
761.8.3.1
77