================
@@ -176,6 +176,28 @@ mlir::LLVM::Linkage convertLinkage(cir::GlobalLinkageKind 
linkage) {
   llvm_unreachable("Unknown CIR linkage type");
 }
 
+static std::optional<mlir::LLVM::CConv>
+convertCallingConv(cir::CallingConv callingConv) {
+  using CIR = cir::CallingConv;
+  using LLVM = mlir::LLVM::CConv;
+
+  switch (callingConv) {
+  case CIR::C:
+    return LLVM::C;
+  case CIR::SpirKernel:
+    return LLVM::SPIR_KERNEL;
+  case CIR::SpirFunction:
+    return LLVM::SPIR_FUNC;
+  case CIR::OpenCLKernel:
+    llvm_unreachable("NYI");
----------------
Lancern wrote:

Add a missing feature assert here and return an empty `std::optional` value:

```suggestion
    assert(!cir::MissingFeatures::callConvOpenCLKernel());
    return std::nullopt;
```

https://github.com/llvm/llvm-project/pull/181170
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to