[llvm] [AMDGPU][GlobalISel] Enable kernel argument preloading (PR #134655)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 25 04:28:21 PDT 2025


================
@@ -497,6 +499,66 @@ static void allocateHSAUserSGPRs(CCState &CCInfo,
   // these from the dispatch pointer.
 }
 
+void AMDGPUCallLowering::lowerPreloadedParameter(
+    MachineIRBuilder &B, ArrayRef<Register> VRegs, Type *ArgTy,
+    uint64_t ArgOffset, Align Alignment,
+    ArrayRef<MCRegister> PreloadRegs) const {
+  MachineFunction &MF = B.getMF();
+  const GCNSubtarget *Subtarget = &MF.getSubtarget<GCNSubtarget>();
+  MachineRegisterInfo &MRI = MF.getRegInfo();
+  const SIRegisterInfo *TRI = Subtarget->getRegisterInfo();
+  const DataLayout &DL = B.getDataLayout();
+
+  LLT ResTy = getLLTForType(*ArgTy, DL);
+  LLT ScalarTy = LLT::scalar(DL.getTypeSizeInBits(ArgTy));
----------------
arsenm wrote:

This isn't the most reliable way to get the register size, it should go through the calling convention type legalization. I guess this works out if we only allow preloaded on the most trivial types? 

https://github.com/llvm/llvm-project/pull/134655


More information about the llvm-commits mailing list