Index: llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp =================================================================== --- llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp +++ llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp @@ -715,6 +715,7 @@ case AMDGPU::SRC_PRIVATE_BASE: case AMDGPU::SRC_PRIVATE_LIMIT: case AMDGPU::SGPR_NULL: + case AMDGPU::MODE: continue; case AMDGPU::SRC_POPS_EXITING_WAVE_ID: Index: llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp =================================================================== --- llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp +++ llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp @@ -205,6 +205,7 @@ BitVector SIRegisterInfo::getReservedRegs(const MachineFunction &MF) const { BitVector Reserved(getNumRegs()); + Reserved.set(AMDGPU::MODE); // EXEC_LO and EXEC_HI could be allocated and used as regular register, but // this seems likely to result in bugs, so I'm marking them as reserved. @@ -1648,15 +1649,16 @@ bool SIRegisterInfo::isVGPR(const MachineRegisterInfo &MRI, Register Reg) const { const TargetRegisterClass *RC = getRegClassForReg(MRI, Reg); - assert(RC && "Register class for the reg not found"); - return hasVGPRs(RC); + // Registers without classes are unaddressable, SGPR-like registers. + return RC && hasVGPRs(RC); } bool SIRegisterInfo::isAGPR(const MachineRegisterInfo &MRI, Register Reg) const { const TargetRegisterClass *RC = getRegClassForReg(MRI, Reg); - assert(RC && "Register class for the reg not found"); - return hasAGPRs(RC); + + // Registers without classes are unaddressable, SGPR-like registers. + return RC && hasAGPRs(RC); } bool SIRegisterInfo::shouldCoalesce(MachineInstr *MI, Index: llvm/lib/Target/AMDGPU/SIRegisterInfo.td =================================================================== --- llvm/lib/Target/AMDGPU/SIRegisterInfo.td +++ llvm/lib/Target/AMDGPU/SIRegisterInfo.td @@ -208,6 +208,9 @@ defm SRC_PRIVATE_LIMIT : SIRegLoHi16<"src_private_limit", 238>; defm SRC_POPS_EXITING_WAVE_ID : SIRegLoHi16<"src_pops_exiting_wave_id", 239>; +// Not addressable +def MODE : SIReg <"mode", 0>; + def LDS_DIRECT : SIReg <"src_lds_direct", 254> { // There is no physical register corresponding to this. This is an // encoding value in a source field, which will ultimately trigger a