xref: /llvm-project/flang/include/flang/Optimizer/Dialect/FIRDialect.h (revision f832beebda6d31fef01a8cb680b82df33c666eef)
1 //===-- Optimizer/Dialect/FIRDialect.h -- FIR dialect -----------*- 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 // Coding style: https://mlir.llvm.org/getting_started/DeveloperGuide/
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef FORTRAN_OPTIMIZER_DIALECT_FIRDIALECT_H
14 #define FORTRAN_OPTIMIZER_DIALECT_FIRDIALECT_H
15 
16 #include "mlir/IR/Dialect.h"
17 
18 #include "flang/Optimizer/Dialect/FIRDialect.h.inc"
19 
20 namespace mlir {
21 class IRMapping;
22 } // namespace mlir
23 
24 namespace fir {
25 
26 /// The FIR codegen dialect is a dialect containing a small set of transient
27 /// operations used exclusively during code generation.
28 class FIRCodeGenDialect final : public mlir::Dialect {
29 public:
30   explicit FIRCodeGenDialect(mlir::MLIRContext *ctx);
31   virtual ~FIRCodeGenDialect();
32 
getDialectNamespace()33   static llvm::StringRef getDialectNamespace() { return "fircg"; }
34 };
35 
36 /// Support for inlining on FIR.
37 bool canLegallyInline(mlir::Operation *op, mlir::Region *reg, bool,
38                       mlir::IRMapping &map);
39 bool canLegallyInline(mlir::Operation *, mlir::Operation *, bool);
40 
41 // Register the FIRInlinerInterface to FIROpsDialect
42 void addFIRInlinerExtension(mlir::DialectRegistry &registry);
43 
44 // Register implementation of LLVMTranslationDialectInterface.
45 void addFIRToLLVMIRExtension(mlir::DialectRegistry &registry);
46 
47 } // namespace fir
48 
49 #endif // FORTRAN_OPTIMIZER_DIALECT_FIRDIALECT_H
50