================ @@ -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:
Hmm, yeah, ideally we'd want to do that but I don't think we can do that easily? Even if I turn off all the errors, stuff like this, for example: ``` register unsigned long r asm("l0"); void set(unsigned long x) { r = x; } ``` Becomes a nop function on clang unless `l0` is reserved. Other LLVM backends also do this (and differ from GCC behavior) so I don't think the issue is localized to ours. So I believe it is better for us to throw an error instead of silently miscompiling code? https://github.com/llvm/llvm-project/pull/74927 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits