1 //===-- FIRDialect.cpp ----------------------------------------------------===// 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 // Coding style: https://mlir.llvm.org/getting_started/DeveloperGuide/ 10 // 11 //===----------------------------------------------------------------------===// 12 13 #include "flang/Optimizer/Dialect/FIRDialect.h" 14 #include "flang/Optimizer/Dialect/FIRAttr.h" 15 #include "flang/Optimizer/Dialect/FIROps.h" 16 #include "flang/Optimizer/Dialect/FIRType.h" 17 18 using namespace fir; 19 20 fir::FIROpsDialect::FIROpsDialect(mlir::MLIRContext *ctx) 21 : mlir::Dialect("fir", ctx, mlir::TypeID::get<FIROpsDialect>()) { 22 registerTypes(); 23 registerAttributes(); 24 addOperations< 25 #define GET_OP_LIST 26 #include "flang/Optimizer/Dialect/FIROps.cpp.inc" 27 >(); 28 } 29 30 // anchor the class vtable to this compilation unit 31 fir::FIROpsDialect::~FIROpsDialect() { 32 // do nothing 33 } 34 35 mlir::Type fir::FIROpsDialect::parseType(mlir::DialectAsmParser &parser) const { 36 return parseFirType(const_cast<FIROpsDialect *>(this), parser); 37 } 38 39 void fir::FIROpsDialect::printType(mlir::Type ty, 40 mlir::DialectAsmPrinter &p) const { 41 return printFirType(const_cast<FIROpsDialect *>(this), ty, p); 42 } 43 44 mlir::Attribute 45 fir::FIROpsDialect::parseAttribute(mlir::DialectAsmParser &parser, 46 mlir::Type type) const { 47 return parseFirAttribute(const_cast<FIROpsDialect *>(this), parser, type); 48 } 49 50 void fir::FIROpsDialect::printAttribute(mlir::Attribute attr, 51 mlir::DialectAsmPrinter &p) const { 52 printFirAttribute(const_cast<FIROpsDialect *>(this), attr, p); 53 } 54