blob: 3e0c483b77a23029c7d41f5ceade6166bf302a0c [file] [log] [blame]
Andrew Geissler10fa1492020-12-11 16:25:29 -06001From 697db2e2c2519f27011fbd1960cd8860133aaa84 Mon Sep 17 00:00:00 2001
Andrew Geissler84ad7c52020-06-27 00:00:16 -05002From: Nagaraju <nmekala@xilinx.com>
3Date: Thu, 9 Jan 2020 12:30:41 +0530
Andrew Geissler10fa1492020-12-11 16:25:29 -06004Subject: [PATCH 51/54] [Patch, microblaze]: Fix Compiler crash with
Andrew Geissler84ad7c52020-06-27 00:00:16 -05005 -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
Andrew Geisslera9ff2b32020-10-16 10:11:54 -050011ChangeLog:
122020-01-09 Nagaraju Mekala <nmekala@xilix.com>
13
14 * gcc/config/microblaze/microblaze.h
15 (LIBCALL_Value): Remove macro
16 (PROMOTE_MODE): Remove macro
17 * gcc/config/microblaze/microblaze.c
18 (TARGET_LIBCALL_Value): Added new macro
19 (microblaze_function_value): Updated the return Value
Andrew Geissler84ad7c52020-06-27 00:00:16 -050020---
21 gcc/config/microblaze/microblaze.c | 11 ++++++++++-
22 gcc/config/microblaze/microblaze.h | 19 -------------------
23 2 files changed, 10 insertions(+), 20 deletions(-)
24
25diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c
Andrew Geissler10fa1492020-12-11 16:25:29 -060026index 7b48c011550..1bba77dab6d 100644
Andrew Geissler84ad7c52020-06-27 00:00:16 -050027--- a/gcc/config/microblaze/microblaze.c
28+++ b/gcc/config/microblaze/microblaze.c
Andrew Geissler10fa1492020-12-11 16:25:29 -060029@@ -3908,7 +3908,16 @@ microblaze_function_value (const_tree valtype,
Andrew Geissler84ad7c52020-06-27 00:00:16 -050030 const_tree func ATTRIBUTE_UNUSED,
31 bool outgoing ATTRIBUTE_UNUSED)
32 {
33- return LIBCALL_VALUE (TYPE_MODE (valtype));
34+ return gen_rtx_REG (TYPE_MODE (valtype), GP_RETURN);
35+}
36+
37+#undef TARGET_LIBCALL_VALUE
38+#define TARGET_LIBCALL_VALUE microblaze_libcall_value
39+
40+rtx
41+microblaze_libcall_value (machine_mode mode, const_rtx fun ATTRIBUTE_UNUSED)
42+{
43+ return gen_rtx_REG (mode, GP_RETURN);
44 }
45
46 /* Implement TARGET_SCHED_ADJUST_COST. */
47diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
Andrew Geissler10fa1492020-12-11 16:25:29 -060048index bfa7bc9a01c..d467a7ee65d 100644
Andrew Geissler84ad7c52020-06-27 00:00:16 -050049--- a/gcc/config/microblaze/microblaze.h
50+++ b/gcc/config/microblaze/microblaze.h
51@@ -266,13 +266,6 @@ extern enum pipeline_type microblaze_pipe;
52
53 #define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
54
55-#ifndef __arch64__
56-#define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \
57- if (GET_MODE_CLASS (MODE) == MODE_INT \
58- && GET_MODE_SIZE (MODE) < 4) \
59- (MODE) = SImode;
60-#endif
61-
62 /* Standard register usage. */
63
64 /* On the MicroBlaze, we have 32 integer registers */
65@@ -471,18 +464,6 @@ extern struct microblaze_frame_info current_frame_info;
66
67 #define MAX_ARGS_IN_REGISTERS MB_ABI_MAX_ARG_REGS
68
69-#ifdef __aarch64__
70-#define LIBCALL_VALUE(MODE) \
71- gen_rtx_REG (MODE,GP_RETURN)
72-#else
73-#define LIBCALL_VALUE(MODE) \
74- gen_rtx_REG ( \
75- ((GET_MODE_CLASS (MODE) != MODE_INT \
76- || GET_MODE_SIZE (MODE) >= 4) \
77- ? (MODE) \
78- : SImode), GP_RETURN)
79-#endif
80-
81 /* 1 if N is a possible register number for a function value.
82 On the MicroBlaze, R2 R3 are the only register thus used.
83 Currently, R2 are only implemented here (C has no complex type) */
84--
Andrew Geisslera9ff2b32020-10-16 10:11:54 -0500852.17.1
Andrew Geissler84ad7c52020-06-27 00:00:16 -050086