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 #include "mlir/Support/LogicalResult.h" 15 16 namespace llvm { 17 class SourceMgr; 18 } // namespace llvm 19 20 namespace mlir { 21 class MLIRContext; 22 class ModuleOp; 23 template <typename OpT> 24 class OwningOpRef; 25 26 namespace pdll { 27 namespace ast { 28 class Context; 29 class Module; 30 } // namespace ast 31 32 /// Given a PDLL module, generate an MLIR PDL pattern module within the given 33 /// MLIR context. 34 OwningOpRef<ModuleOp> codegenPDLLToMLIR(MLIRContext *mlirContext, 35 const ast::Context &context, 36 const llvm::SourceMgr &sourceMgr, 37 const ast::Module &module); 38 } // namespace pdll 39 } // namespace mlir 40 41 #endif // MLIR_TOOLS_PDLL_CODEGEN_MLIRGEN_H_ 42