1 //===- MLIRGen.h - MLIR PDLL Code Generation --------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef MLIR_TOOLS_PDLL_CODEGEN_MLIRGEN_H_ 10 #define MLIR_TOOLS_PDLL_CODEGEN_MLIRGEN_H_ 11 12 #include <memory> 13 14 namespace llvm { 15 class SourceMgr; 16 } // namespace llvm 17 18 namespace mlir { 19 class MLIRContext; 20 class ModuleOp; 21 template <typename OpT> 22 class OwningOpRef; 23 24 namespace pdll { 25 namespace ast { 26 class Context; 27 class Module; 28 } // namespace ast 29 30 /// Given a PDLL module, generate an MLIR PDL pattern module within the given 31 /// MLIR context. 32 OwningOpRef<ModuleOp> codegenPDLLToMLIR(MLIRContext *mlirContext, 33 const ast::Context &context, 34 const llvm::SourceMgr &sourceMgr, 35 const ast::Module &module); 36 } // namespace pdll 37 } // namespace mlir 38 39 #endif // MLIR_TOOLS_PDLL_CODEGEN_MLIRGEN_H_ 40