================
@@ -80,12 +80,19 @@ unsigned 
CodeGenTypes::ClangCallConvToLLVMCallConv(CallingConv CC) {
     return llvm::CallingConv::AArch64_VectorCall;
   case CC_AArch64SVEPCS:
     return llvm::CallingConv::AArch64_SVE_VectorCall;
-  case CC_AMDGPUKernelCall:
-    return llvm::CallingConv::AMDGPU_KERNEL;
   case CC_SpirFunction:
     return llvm::CallingConv::SPIR_FUNC;
-  case CC_OpenCLKernel:
-    return CGM.getTargetCodeGenInfo().getOpenCLKernelCallingConv();
+  case CC_DeviceKernel: {
+    if (CGM.getLangOpts().OpenCL)
+      return CGM.getTargetCodeGenInfo().getOpenCLKernelCallingConv();
+    if (CGM.getTriple().isSPIROrSPIRV())
+      return llvm::CallingConv::SPIR_KERNEL;
+    if (CGM.getTriple().isAMDGPU())
+      return llvm::CallingConv::AMDGPU_KERNEL;
+    if (CGM.getTriple().isNVPTX())
+      return llvm::CallingConv::PTX_Kernel;
+    llvm_unreachable("Unknown kernel calling convention");
+  }
----------------
bader wrote:

@sarnex,
IMHO, the implementation of `CC_DeviceKernel` case should look like:

```c++
  case CC_DeviceKernel:
    return CGM.getTargetCodeGenInfo().getDeviceKernelCallingConv();
```
SPIR/SPIR-V/NVPTX/AMDGPU targets should define target specific calling 
convention.

i.e. getOpenCLKernelCallingConv -> getDeviceKernelCallingConv.


https://github.com/llvm/llvm-project/pull/137882
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to