]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
RISC-V: Improve caller-save code generation.
authorJim Wilson <jimw@sifive.com>
Sat, 8 Feb 2020 21:57:36 +0000 (13:57 -0800)
committerJim Wilson <jimw@sifive.com>
Sat, 8 Feb 2020 21:57:36 +0000 (13:57 -0800)
Avoid paradoxical subregs when caller save.  This reduces stack frame size
due to smaller loads and stores, and more frequent rematerialization.

PR target/93532
* config/riscv/riscv.h (HARD_REGNO_CALLER_SAVE_MODE): Define.

gcc/ChangeLog
gcc/config/riscv/riscv.h

index ed3aac49f1bec63196a223d87b0ce6beffe9ecc0..0ae8c5442a0bfba4f5da79ee8f4a83d7f7a6a1a1 100644 (file)
@@ -1,3 +1,8 @@
+2020-02-08  Jim Wilson  <jimw@sifive.com>
+
+       PR target/93532
+       * config/riscv/riscv.h (HARD_REGNO_CALLER_SAVE_MODE): Define.
+
 2020-02-08  Uroš Bizjak  <ubizjak@gmail.com>
            Jakub Jelinek  <jakub@redhat.com>
 
index 19438e28fe88b92d91b610e9a1760c13f1d88be5..567c23380feb8d219f2a6fbce5e354154a239207 100644 (file)
@@ -268,6 +268,13 @@ along with GCC; see the file COPYING3.  If not see
   1, 1                                                                 \
 }
 
+/* Select a register mode required for caller save of hard regno REGNO.
+   Contrary to what is documented, the default is not the smallest suitable
+   mode but the largest suitable mode for the given (REGNO, NREGS) pair and
+   it quickly creates paradoxical subregs that can be problematic.  */
+#define HARD_REGNO_CALLER_SAVE_MODE(REGNO, NREGS, MODE) \
+  ((MODE) == VOIDmode ? choose_hard_reg_mode (REGNO, NREGS, NULL) : (MODE))
+
 /* Internal macros to classify an ISA register's type.  */
 
 #define GP_REG_FIRST 0