diff options
Diffstat (limited to 'meta-microblaze/recipes-devtools/gcc/gcc-12/0049-Patch-microblaze-Fix-Compiler-crash-with-freg-struct.patch')
| -rw-r--r-- | meta-microblaze/recipes-devtools/gcc/gcc-12/0049-Patch-microblaze-Fix-Compiler-crash-with-freg-struct.patch | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0049-Patch-microblaze-Fix-Compiler-crash-with-freg-struct.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0049-Patch-microblaze-Fix-Compiler-crash-with-freg-struct.patch new file mode 100644 index 00000000..163d4925 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0049-Patch-microblaze-Fix-Compiler-crash-with-freg-struct.patch | |||
| @@ -0,0 +1,86 @@ | |||
| 1 | From 2673e0dc2d75769c7cc36ca94e4e07caa28b8ef7 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Nagaraju <nmekala@xilinx.com> | ||
| 3 | Date: Thu, 9 Jan 2020 12:30:41 +0530 | ||
| 4 | Subject: [PATCH 49/53] [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 | |||
| 9 | Signed-off-by :Nagaraju Mekala <nmekala@xilix.com> | ||
| 10 | |||
| 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 | ||
| 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 | ||
| 26 | index d1257032bfb..5afac2ba8d1 100644 | ||
| 27 | --- a/gcc/config/microblaze/microblaze.c | ||
| 28 | +++ b/gcc/config/microblaze/microblaze.c | ||
| 29 | @@ -3908,7 +3908,16 @@ microblaze_function_value (const_tree valtype, | ||
| 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 | ||
| 48 | index c6c3a9baa5a..2581d52d17a 100644 | ||
| 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 | -- | ||
| 85 | 2.17.1 | ||
| 86 | |||
