[llvm] [AMDGPU] Add pal metadata 3.0 support to callable pal funcs (PR #67104)
Carl Ritson via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 10 22:26:54 PDT 2023
================
@@ -1098,10 +1098,30 @@ void AMDGPUAsmPrinter::emitPALFunctionMetadata(const MachineFunction &MF) {
StringRef FnName = MF.getFunction().getName();
MD->setFunctionScratchSize(FnName, MFI.getStackSize());
- // Set compute registers
- MD->setRsrc1(CallingConv::AMDGPU_CS,
- CurrentProgramInfo.getPGMRSrc1(CallingConv::AMDGPU_CS));
- MD->setRsrc2(CallingConv::AMDGPU_CS, CurrentProgramInfo.getComputePGMRSrc2());
+ if (MD->getPALMajorVersion() < 3) {
+ // Set compute registers
+ MD->setRsrc1(CallingConv::AMDGPU_CS,
+ CurrentProgramInfo.getPGMRSrc1(CallingConv::AMDGPU_CS));
+ MD->setRsrc2(CallingConv::AMDGPU_CS,
+ CurrentProgramInfo.getComputePGMRSrc2());
+ } else {
+ MD->setHwStage(CallingConv::AMDGPU_CS, ".ieee_mode",
+ (bool)CurrentProgramInfo.IEEEMode);
+ MD->setHwStage(CallingConv::AMDGPU_CS, ".wgp_mode",
+ (bool)CurrentProgramInfo.WgpMode);
+ MD->setHwStage(CallingConv::AMDGPU_CS, ".mem_ordered",
+ (bool)CurrentProgramInfo.MemOrdered);
+
+ MD->setHwStage(CallingConv::AMDGPU_CS, ".trap_present",
+ (bool)CurrentProgramInfo.TrapHandlerEnable);
+ MD->setHwStage(CallingConv::AMDGPU_CS, ".excp_en",
+ CurrentProgramInfo.EXCPEnable);
+
+ const unsigned LdsDwGranularity = 128;
----------------
perlfu wrote:
Looking at this again, this seems to be duplicating code already in AMDGPUAsmPrinter::EmitPALMetadata.
Can we share code instead?
Particular AMDGPUAsmPrinter::EmitPALMetadata seems to cover more fields which are perhaps relevant here too?
https://github.com/llvm/llvm-project/pull/67104
More information about the llvm-commits
mailing list