https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87948
Bug ID: 87948 Summary: LRA register allocator does not support HARD_REGNO_CALLER_SAVE_MODE returning VOIDmode Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: meissner at gcc dot gnu.org Target Milestone: --- The documentation for HARD_REGNO_CALLER_SAVE_MODE states: @defmac HARD_REGNO_CALLER_SAVE_MODE (@var{regno}, @var{nregs}) A C expression specifying which mode is required for saving @var{nregs} of a pseudo-register in call-clobbered hard register @var{regno}. If @var{regno} is unsuitable for caller save, @code{VOIDmode} should be returned. For most machines this macro need not be defined since GCC will select the smallest suitable mode. @end defmac I was trying to prevent the GCC compiler from saving and restoring CR registers across calls, so I defined HARD_REGNO_CALLER_SAVE_MODE as: /* When setting up caller-save slots (MODE == VOIDmode) ensure we allocate enough space to account for vectors in FP regs. However, TFmode/TDmode should not use VSX instructions to do a caller save. Return VOIDmode for the CR registers so that we don't try to save them across calls. */ #define HARD_REGNO_CALLER_SAVE_MODE(REGNO, NREGS, MODE) \ (CR_REGNO_P (REGNO) \ ? VOIDmode \ : (NREGS) <= rs6000_hard_regno_nregs[MODE][REGNO] \ ? (MODE) \ : TARGET_VSX \ && ((MODE) == VOIDmode || ALTIVEC_OR_VSX_VECTOR_MODE (MODE)) \ && FP_REGNO_P (REGNO) \ ? V2DFmode \ : FLOAT128_IBM_P (MODE) && FP_REGNO_P (REGNO) \ ? DFmode \ : (MODE) == TDmode && FP_REGNO_P (REGNO) \ ? DImode \ : choose_hard_reg_mode ((REGNO), (NREGS), false)) However, when I try to build the compiler (without bootstrap initially), I get the following error: during RTL pass: reload /home/meissner/fsf-src/test/libbacktrace/elf.c: In function 'elf_add': /home/meissner/fsf-src/test/libbacktrace/elf.c:3211:1: internal compiler error: in lra_create_new_reg_with_unique_value, at lra.c:189 3211 | } | ^ 0x107bba3f lra_create_new_reg_with_unique_value(machine_mode, rtx_def*, reg_class, char const*) /home/meissner/fsf-src/test/gcc/lra.c:189 0x107bbabf lra_create_new_reg(machine_mode, rtx_def*, reg_class, char const*) /home/meissner/fsf-src/test/gcc/lra.c:229 0x107ce00b split_reg /home/meissner/fsf-src/test/gcc/lra-constraints.c:5566 0x107d5aa3 inherit_in_ebb /home/meissner/fsf-src/test/gcc/lra-constraints.c:6568 0x107d5aa3 lra_inheritance() /home/meissner/fsf-src/test/gcc/lra-constraints.c:6639 0x107c0f37 lra(_IO_FILE*) /home/meissner/fsf-src/test/gcc/lra.c:2486 0x1075abeb do_reload /home/meissner/fsf-src/test/gcc/ira.c:5469 0x1075abeb execute /home/meissner/fsf-src/test/gcc/ira.c:5653 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. Makefile:820: recipe for target 'elf.lo' failed make[3]: *** [elf.lo] Error 1 make[3]: Leaving directory '/home/meissner/fsf-build-ppc64le/test/powerpc64le-unknown-linux-gnu/libbacktrace' Makefile:700: recipe for target 'all' failed make[2]: *** [all] Error 2 make[2]: Leaving directory '/home/meissner/fsf-build-ppc64le/test/powerpc64le-unknown-linux-gnu/libbacktrace' Makefile:13084: recipe for target 'all-target-libbacktrace' failed make[1]: *** [all-target-libbacktrace] Error 2 make[1]: Leaving directory '/home/meissner/fsf-build-ppc64le/test' Makefile:939: recipe for target 'all' failed make: *** [all] Error 2