27 static constexpr llvm::StringRef
kPrintI64 =
"printI64";
28 static constexpr llvm::StringRef
kPrintU64 =
"printU64";
29 static constexpr llvm::StringRef
kPrintF32 =
"printF32";
30 static constexpr llvm::StringRef
kPrintF64 =
"printF64";
31 static constexpr llvm::StringRef
kPrintStr =
"puts";
32 static constexpr llvm::StringRef
kPrintOpen =
"printOpen";
36 static constexpr llvm::StringRef
kMalloc =
"malloc";
38 static constexpr llvm::StringRef
kFree =
"free";
39 static constexpr llvm::StringRef
kGenericAlloc =
"_mlir_memref_to_llvm_alloc";
41 "_mlir_memref_to_llvm_aligned_alloc";
42 static constexpr llvm::StringRef
kGenericFree =
"_mlir_memref_to_llvm_free";
49 auto func = moduleOp.lookupSymbol<LLVM::LLVMFuncOp>(name);
53 return b.
create<LLVM::LLVMFuncOp>(
54 moduleOp->getLoc(), name,
55 LLVM::LLVMFunctionType::get(resultType, paramTypes));
60 IntegerType::get(moduleOp->getContext(), 64),
61 LLVM::LLVMVoidType::get(moduleOp->getContext()));
66 IntegerType::get(moduleOp->getContext(), 64),
67 LLVM::LLVMVoidType::get(moduleOp->getContext()));
72 Float32Type::get(moduleOp->getContext()),
73 LLVM::LLVMVoidType::get(moduleOp->getContext()));
78 Float64Type::get(moduleOp->getContext()),
79 LLVM::LLVMVoidType::get(moduleOp->getContext()));
85 LLVM::LLVMPointerType::get(IntegerType::get(moduleOp->getContext(), 8)),
86 LLVM::LLVMVoidType::get(moduleOp->getContext()));
91 LLVM::LLVMVoidType::get(moduleOp->getContext()));
96 LLVM::LLVMVoidType::get(moduleOp->getContext()));
101 LLVM::LLVMVoidType::get(moduleOp->getContext()));
106 LLVM::LLVMVoidType::get(moduleOp->getContext()));
113 LLVM::LLVMPointerType::get(IntegerType::get(moduleOp->getContext(), 8)));
120 LLVM::LLVMPointerType::get(IntegerType::get(moduleOp->getContext(), 8)));
126 LLVM::LLVMPointerType::get(IntegerType::get(moduleOp->getContext(), 8)),
127 LLVM::LLVMVoidType::get(moduleOp->getContext()));
134 LLVM::LLVMPointerType::get(IntegerType::get(moduleOp->getContext(), 8)));
142 LLVM::LLVMPointerType::get(IntegerType::get(moduleOp->getContext(), 8)));
148 LLVM::LLVMPointerType::get(IntegerType::get(moduleOp->getContext(), 8)),
149 LLVM::LLVMVoidType::get(moduleOp->getContext()));
154 Type unrankedDescriptorType) {
157 ArrayRef<Type>{indexType, unrankedDescriptorType, unrankedDescriptorType},
158 LLVM::LLVMVoidType::get(moduleOp->getContext()));
static constexpr llvm::StringRef kPrintI64
Helper functions to lookup or create the declaration for commonly used external C function calls.
static constexpr llvm::StringRef kFree
static constexpr llvm::StringRef kPrintU64
static constexpr llvm::StringRef kGenericAlignedAlloc
static constexpr llvm::StringRef kAlignedAlloc
static constexpr llvm::StringRef kPrintClose
static constexpr llvm::StringRef kMalloc
static constexpr llvm::StringRef kMemRefCopy
static constexpr llvm::StringRef kPrintComma
static constexpr llvm::StringRef kGenericAlloc
static constexpr llvm::StringRef kPrintNewline
static constexpr llvm::StringRef kPrintOpen
static constexpr llvm::StringRef kGenericFree
static constexpr llvm::StringRef kPrintF32
static constexpr llvm::StringRef kPrintF64
static constexpr llvm::StringRef kPrintStr
This class helps build Operations.
Operation * create(const OperationState &state)
Creates an operation given the fields represented as an OperationState.
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
LLVM::LLVMFuncOp lookupOrCreateGenericFreeFn(ModuleOp moduleOp)
LLVM::LLVMFuncOp lookupOrCreateAlignedAllocFn(ModuleOp moduleOp, Type indexType)
LLVM::LLVMFuncOp lookupOrCreateMemRefCopyFn(ModuleOp moduleOp, Type indexType, Type unrankedDescriptorType)
LLVM::LLVMFuncOp lookupOrCreateGenericAlignedAllocFn(ModuleOp moduleOp, Type indexType)
LLVM::LLVMFuncOp lookupOrCreateFreeFn(ModuleOp moduleOp)
LLVM::LLVMFuncOp lookupOrCreateFn(ModuleOp moduleOp, StringRef name, ArrayRef< Type > paramTypes={}, Type resultType={})
Create a FuncOp with signature resultType(paramTypes)and namename`.
LLVM::LLVMFuncOp lookupOrCreateMallocFn(ModuleOp moduleOp, Type indexType)
LLVM::LLVMFuncOp lookupOrCreatePrintU64Fn(ModuleOp moduleOp)
LLVM::LLVMFuncOp lookupOrCreatePrintF64Fn(ModuleOp moduleOp)
LLVM::LLVMFuncOp lookupOrCreateGenericAllocFn(ModuleOp moduleOp, Type indexType)
LLVM::LLVMFuncOp lookupOrCreatePrintNewlineFn(ModuleOp moduleOp)
LLVM::LLVMFuncOp lookupOrCreatePrintCommaFn(ModuleOp moduleOp)
LLVM::LLVMFuncOp lookupOrCreatePrintCloseFn(ModuleOp moduleOp)
LLVM::LLVMFuncOp lookupOrCreatePrintF32Fn(ModuleOp moduleOp)
LLVM::LLVMFuncOp lookupOrCreatePrintOpenFn(ModuleOp moduleOp)
LLVM::LLVMFuncOp lookupOrCreatePrintI64Fn(ModuleOp moduleOp)
Helper functions to lookup or create the declaration for commonly used external C function calls.
LLVM::LLVMFuncOp lookupOrCreatePrintStrFn(ModuleOp moduleOp)
Include the generated interface declarations.