File tree Expand file tree Collapse file tree 9 files changed +24
-20
lines changed
flang/include/flang/Optimizer/Support
Dialect/LLVMIR/Transforms Expand file tree Collapse file tree 9 files changed +24
-20
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ namespace fir::support {
46
46
inline void registerNonCodegenDialects (mlir::DialectRegistry ®istry) {
47
47
registry.insert <FLANG_NONCODEGEN_DIALECT_LIST>();
48
48
mlir::func::registerInlinerExtension (registry);
49
+ mlir::LLVM::registerInlinerInterface (registry);
49
50
}
50
51
51
52
// / Register all the dialects used by flang.
Original file line number Diff line number Diff line change 12
12
13
13
#include " mlir/Dialect/Func/Extensions/AllExtensions.h"
14
14
#include " mlir/Dialect/LLVMIR/LLVMDialect.h"
15
+ #include " mlir/Dialect/LLVMIR/Transforms/InlinerInterfaceImpl.h"
15
16
#include " toy/AST.h"
16
17
#include " toy/Dialect.h"
17
18
#include " toy/Lexer.h"
@@ -299,6 +300,7 @@ int main(int argc, char **argv) {
299
300
// If we aren't dumping the AST, then we are compiling with/to MLIR.
300
301
mlir::DialectRegistry registry;
301
302
mlir::func::registerAllExtensions (registry);
303
+ mlir::LLVM::registerInlinerInterface (registry);
302
304
303
305
mlir::MLIRContext context (registry);
304
306
// Load our Dialect in this MLIR Context.
Original file line number Diff line number Diff line change 12
12
13
13
#include " mlir/Dialect/Func/Extensions/AllExtensions.h"
14
14
#include " mlir/Dialect/LLVMIR/LLVMDialect.h"
15
+ #include " mlir/Dialect/LLVMIR/Transforms/InlinerInterfaceImpl.h"
15
16
#include " toy/AST.h"
16
17
#include " toy/Dialect.h"
17
18
#include " toy/Lexer.h"
@@ -300,6 +301,7 @@ int main(int argc, char **argv) {
300
301
// If we aren't dumping the AST, then we are compiling with/to MLIR.
301
302
mlir::DialectRegistry registry;
302
303
mlir::func::registerAllExtensions (registry);
304
+ mlir::LLVM::registerInlinerInterface (registry);
303
305
304
306
mlir::MLIRContext context (registry);
305
307
// Load our Dialect in this MLIR Context.
Original file line number Diff line number Diff line change 1
- // ===- LLVMInlining .h - Registration of LLVMInlinerInterface - ---*- C++ -*-===//
1
+ // ===- InlinerInterfaceImpl .h - Inlining for LLVM the dialect ---*- C++ -*-===//
2
2
//
3
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
4
// See https://llvm.org/LICENSE.txt for license information.
5
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
6
//
7
7
// ===----------------------------------------------------------------------===//
8
8
//
9
- // Allows registering the LLVM DialectInlinerInterface with the LLVM dialect
10
- // during initialization.
9
+ // Allows registering the LLVM DialectInlinerInterface with the LLVM dialect.
11
10
//
12
11
// ===----------------------------------------------------------------------===//
13
12
14
- #ifndef DIALECT_LLVMIR_IR_LLVMINLINING_H
15
- #define DIALECT_LLVMIR_IR_LLVMINLINING_H
13
+ #ifndef MLIR_DIALECT_LLVMIR_TRANSFORMS_INLINERINTERFACEIMPL_H
14
+ #define MLIR_DIALECT_LLVMIR_TRANSFORMS_INLINERINTERFACEIMPL_H
16
15
17
16
namespace mlir {
18
- namespace LLVM {
19
-
20
- class LLVMDialect ;
17
+ class DialectRegistry ;
21
18
22
- namespace detail {
19
+ namespace LLVM {
23
20
24
21
// / Register the `LLVMInlinerInterface` implementation of
25
22
// / `DialectInlinerInterface` with the LLVM dialect.
26
- void addLLVMInlinerInterface (LLVMDialect *dialect);
27
-
28
- } // namespace detail
23
+ void registerInlinerInterface (DialectRegistry ®istry);
29
24
30
25
} // namespace LLVM
31
26
} // namespace mlir
32
27
33
- #endif // DIALECT_LLVMIR_IR_LLVMINLINING_H
28
+ #endif // MLIR_DIALECT_LLVMIR_TRANSFORMS_INLINERINTERFACEIMPL_H
Original file line number Diff line number Diff line change 43
43
#include " mlir/Dialect/LLVMIR/LLVMDialect.h"
44
44
#include " mlir/Dialect/LLVMIR/NVVMDialect.h"
45
45
#include " mlir/Dialect/LLVMIR/ROCDLDialect.h"
46
+ #include " mlir/Dialect/LLVMIR/Transforms/InlinerInterfaceImpl.h"
46
47
#include " mlir/Dialect/Linalg/IR/Linalg.h"
47
48
#include " mlir/Dialect/Linalg/Transforms/AllInterfaces.h"
48
49
#include " mlir/Dialect/Linalg/Transforms/RuntimeOpVerification.h"
@@ -164,6 +165,7 @@ inline void registerAllDialects(DialectRegistry ®istry) {
164
165
cf::registerBufferizableOpInterfaceExternalModels (registry);
165
166
cf::registerBufferDeallocationOpInterfaceExternalModels (registry);
166
167
gpu::registerBufferDeallocationOpInterfaceExternalModels (registry);
168
+ LLVM::registerInlinerInterface (registry);
167
169
linalg::registerAllDialectInterfaceImplementations (registry);
168
170
linalg::registerRuntimeVerifiableOpInterfaceExternalModels (registry);
169
171
memref::registerAllocationOpInterfaceExternalModels (registry);
Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ add_mlir_dialect_library(MLIRLLVMDialect
4
4
IR/FunctionCallUtils.cpp
5
5
IR/LLVMAttrs.cpp
6
6
IR/LLVMDialect.cpp
7
- IR/LLVMInlining.cpp
8
7
IR/LLVMInterfaces.cpp
9
8
IR/LLVMMemorySlot.cpp
10
9
IR/LLVMTypes.cpp
Original file line number Diff line number Diff line change 12
12
// ===----------------------------------------------------------------------===//
13
13
14
14
#include " mlir/Dialect/LLVMIR/LLVMDialect.h"
15
- #include " LLVMInlining.h"
16
15
#include " TypeDetail.h"
17
16
#include " mlir/Dialect/LLVMIR/LLVMAttrs.h"
18
17
#include " mlir/Dialect/LLVMIR/LLVMInterfaces.h"
24
23
#include " mlir/IR/MLIRContext.h"
25
24
#include " mlir/IR/Matchers.h"
26
25
#include " mlir/Interfaces/FunctionImplementation.h"
26
+ #include " mlir/Transforms/InliningUtils.h"
27
27
28
28
#include " llvm/ADT/SCCIterator.h"
29
29
#include " llvm/ADT/TypeSwitch.h"
@@ -3252,7 +3252,7 @@ void LLVMDialect::initialize() {
3252
3252
// clang-format off
3253
3253
addInterfaces<LLVMOpAsmDialectInterface>();
3254
3254
// clang-format on
3255
- detail::addLLVMInlinerInterface ( this );
3255
+ declarePromisedInterface<DialectInlinerInterface, LLVMDialect>( );
3256
3256
}
3257
3257
3258
3258
#define GET_OP_CLASSES
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ add_mlir_dialect_library(MLIRLLVMIRTransforms
3
3
DIExpressionLegalization.cpp
4
4
DIExpressionRewriter.cpp
5
5
DIScopeForLLVMFuncOp.cpp
6
+ InlinerInterfaceImpl.cpp
6
7
LegalizeForExport.cpp
7
8
OptimizeForNVVM.cpp
8
9
RequestCWrappers.cpp
Original file line number Diff line number Diff line change 1
- // ===- LLVMInlining .cpp - LLVM inlining interface and logic -----*- C++ -* -===//
1
+ // ===- InlinerInterfaceImpl .cpp - Inlining for LLVM the dialect ---------- -===//
2
2
//
3
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
4
// See https://llvm.org/LICENSE.txt for license information.
11
11
//
12
12
// ===----------------------------------------------------------------------===//
13
13
14
- #include " LLVMInlining .h"
14
+ #include " mlir/Dialect/LLVMIR/Transforms/InlinerInterfaceImpl .h"
15
15
#include " mlir/Dialect/LLVMIR/LLVMDialect.h"
16
16
#include " mlir/IR/Matchers.h"
17
17
#include " mlir/Interfaces/DataLayoutInterfaces.h"
@@ -850,6 +850,8 @@ struct LLVMInlinerInterface : public DialectInlinerInterface {
850
850
851
851
} // end anonymous namespace
852
852
853
- void LLVM::detail::addLLVMInlinerInterface (LLVM::LLVMDialect *dialect) {
854
- dialect->addInterfaces <LLVMInlinerInterface>();
853
+ void mlir::LLVM::registerInlinerInterface (DialectRegistry ®istry) {
854
+ registry.addExtension (+[](MLIRContext *ctx, LLVM::LLVMDialect *dialect) {
855
+ dialect->addInterfaces <LLVMInlinerInterface>();
856
+ });
855
857
}
You can’t perform that action at this time.
0 commit comments