[Mlir-commits] [mlir] [mlir][spirv] Add spirv-to-llvm conversion for OpControlBarrier (PR #111864)
Jakub Kuderski
llvmlistbot at llvm.org
Fri Oct 11 09:39:38 PDT 2024
================
@@ -1024,6 +1024,71 @@ class ReturnValuePattern : public SPIRVToLLVMConversion<spirv::ReturnValueOp> {
}
};
+static LLVM::LLVMFuncOp lookupOrCreateSPIRVFn(Operation *symbolTable,
+ StringRef name,
+ ArrayRef<Type> paramTypes,
+ Type resultType) {
+ auto func = dyn_cast_or_null<LLVM::LLVMFuncOp>(
+ SymbolTable::lookupSymbolIn(symbolTable, name));
+ if (func)
+ return func;
+
+ OpBuilder b(symbolTable->getRegion(0));
+ func = b.create<LLVM::LLVMFuncOp>(
+ symbolTable->getLoc(), name,
+ LLVM::LLVMFunctionType::get(resultType, paramTypes));
+ func.setCConv(LLVM::cconv::CConv::SPIR_FUNC);
+ func.setConvergent(true);
+ func.setNoUnwind(true);
+ func.setWillReturn(true);
+ return func;
+}
+
+static LLVM::CallOp createSPIRVBuiltinCall(Location loc, OpBuilder &rewriter,
----------------
kuhar wrote:
nit: s/rewriter/builder/
https://github.com/llvm/llvm-project/pull/111864
More information about the Mlir-commits
mailing list