Andrew Geissler | 10fa149 | 2020-12-11 16:25:29 -0600 | [diff] [blame^] | 1 | From 697db2e2c2519f27011fbd1960cd8860133aaa84 Mon Sep 17 00:00:00 2001 |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 2 | From: Nagaraju <nmekala@xilinx.com> |
| 3 | Date: Thu, 9 Jan 2020 12:30:41 +0530 |
Andrew Geissler | 10fa149 | 2020-12-11 16:25:29 -0600 | [diff] [blame^] | 4 | Subject: [PATCH 51/54] [Patch, microblaze]: Fix Compiler crash with |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 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 | |
| 9 | Signed-off-by :Nagaraju Mekala <nmekala@xilix.com> |
| 10 | |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame] | 11 | ChangeLog: |
| 12 | 2020-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 Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 20 | --- |
| 21 | gcc/config/microblaze/microblaze.c | 11 ++++++++++- |
| 22 | gcc/config/microblaze/microblaze.h | 19 ------------------- |
| 23 | 2 files changed, 10 insertions(+), 20 deletions(-) |
| 24 | |
| 25 | diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c |
Andrew Geissler | 10fa149 | 2020-12-11 16:25:29 -0600 | [diff] [blame^] | 26 | index 7b48c011550..1bba77dab6d 100644 |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 27 | --- a/gcc/config/microblaze/microblaze.c |
| 28 | +++ b/gcc/config/microblaze/microblaze.c |
Andrew Geissler | 10fa149 | 2020-12-11 16:25:29 -0600 | [diff] [blame^] | 29 | @@ -3908,7 +3908,16 @@ microblaze_function_value (const_tree valtype, |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 30 | 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. */ |
| 47 | diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h |
Andrew Geissler | 10fa149 | 2020-12-11 16:25:29 -0600 | [diff] [blame^] | 48 | index bfa7bc9a01c..d467a7ee65d 100644 |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 49 | --- 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 Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame] | 85 | 2.17.1 |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 86 | |