================
@@ -75,11 +79,80 @@ class CIRDialectLLVMIRTranslationInterface
 
     // Strip the "cir." prefix to get the LLVM attribute name.
     llvm::StringRef llvmAttrName = attrName.substr(strlen("cir."));
-    if (auto strAttr = mlir::dyn_cast<mlir::StringAttr>(attribute.getValue()))
+    if (auto clArgMetadata = mlir::dyn_cast<cir::OpenCLKernelArgMetadataAttr>(
+            attribute.getValue())) {
+      emitOpenCLKernelArgMetadata(clArgMetadata, llvmFunc, moduleTranslation);
+    } else if (auto strAttr =
+                   mlir::dyn_cast<mlir::StringAttr>(attribute.getValue())) {
       llvmFunc->addFnAttr(llvmAttrName, strAttr.getValue());
+    }
     return mlir::success();
   }
 
+  void emitOpenCLKernelArgMetadata(
+      cir::OpenCLKernelArgMetadataAttr clArgMetadata, llvm::Function *llvmFunc,
+      mlir::LLVM::ModuleTranslation &moduleTranslation) const {
+    llvm::LLVMContext &llvmContext = moduleTranslation.getLLVMContext();
+
+    SmallVector<llvm::Metadata *, 8> addressQuals;
+
+    auto getOpenCLArgInfoAddressSpace = [](cir::LangAddressSpace addressSpace) 
{
----------------
RiverDave wrote:

This transformation shoud've been handled earlier in TargetLowering pass. You 
might need to evaluate if the existing pass can handle generic cir attributes 
carrying AS.

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

Reply via email to