[llvm] [clang] [SPARC] Support reserving arbitrary general purpose registers (PR #74927)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 10 06:50:09 PST 2024
================
@@ -1125,6 +1130,10 @@ Register SparcTargetLowering::getRegisterByName(const char* RegName, LLT VT,
.Case("g4", SP::G4).Case("g5", SP::G5).Case("g6", SP::G6).Case("g7", SP::G7)
.Default(0);
+ const SparcRegisterInfo *TRI = Subtarget->getRegisterInfo();
+ if (!TRI->isReservedReg(MF, Reg))
+ Reg = 0;
----------------
koachan wrote:
> Because of that, allocatable registers are not supported.
Yeah, this seems to be the main difference between them, from what I understand.
GCC does warn you about it, but it will still allow you to read/write allocatable registers. LLVM, on the other hand, will flat out refuse to do that (either by hard-crashing or turning the read/write_register intrinsics into nops).
And yes, this should be enough for the Linux kernel, methinks.
- - - - -
Also, re:testing, how should I test this, given that the expected failure mode is a hard crash?
I don't know if there's any way to tell the test framework that a hard crash is the intended result.
https://github.com/llvm/llvm-project/pull/74927
More information about the cfe-commits
mailing list