AMDGPU: Error if too many user SGPRs used

llvm-svn: 254332
This commit is contained in:
Matt Arsenault 2015-11-30 21:16:07 +00:00
parent 26f8f3db39
commit 41003af292
2 changed files with 8 additions and 0 deletions

View File

@ -401,6 +401,11 @@ void AMDGPUAsmPrinter::getSIProgramInfo(SIProgramInfo &ProgInfo,
ProgInfo.NumSGPR = AMDGPUSubtarget::FIXED_SGPR_COUNT_FOR_INIT_BUG;
}
if (MFI->NumUserSGPRs > STM.getMaxNumUserSGPRs()) {
LLVMContext &Ctx = MF.getFunction()->getContext();
Ctx.emitError("too many user SGPRs used");
}
ProgInfo.VGPRBlocks = (ProgInfo.NumVGPR - 1) / 4;
ProgInfo.SGPRBlocks = (ProgInfo.NumSGPR - 1) / 8;
// Set the value to initialize FP_ROUND and FP_DENORM parts of the mode

View File

@ -303,6 +303,9 @@ public:
return isAmdHsaOS() ? 0 : 36;
}
unsigned getMaxNumUserSGPRs() const {
return 16;
}
};
} // End namespace llvm