MLIR  18.0.0git
FuncTransformOps.cpp
Go to the documentation of this file.
1 //===- FuncTransformOps.cpp - Implementation of CF transform ops ---===//
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 
10 
18 
19 using namespace mlir;
20 
21 //===----------------------------------------------------------------------===//
22 // Apply...ConversionPatternsOp
23 //===----------------------------------------------------------------------===//
24 
25 void transform::ApplyFuncToLLVMConversionPatternsOp::populatePatterns(
26  TypeConverter &typeConverter, RewritePatternSet &patterns) {
28  static_cast<LLVMTypeConverter &>(typeConverter), patterns);
29 }
30 
32 transform::ApplyFuncToLLVMConversionPatternsOp::verifyTypeConverter(
33  transform::TypeConverterBuilderOpInterface builder) {
34  if (builder.getTypeConverterType() != "LLVMTypeConverter")
35  return emitOpError("expected LLVMTypeConverter");
36  return success();
37 }
38 
39 //===----------------------------------------------------------------------===//
40 // Transform op registration
41 //===----------------------------------------------------------------------===//
42 
43 namespace {
44 class FuncTransformDialectExtension
46  FuncTransformDialectExtension> {
47 public:
48  using Base::Base;
49 
50  void init() {
51  declareGeneratedDialect<LLVM::LLVMDialect>();
52 
53  registerTransformOps<
54 #define GET_OP_LIST
55 #include "mlir/Dialect/Func/TransformOps/FuncTransformOps.cpp.inc"
56  >();
57  }
58 };
59 } // namespace
60 
61 #define GET_OP_CLASSES
62 #include "mlir/Dialect/Func/TransformOps/FuncTransformOps.cpp.inc"
63 
65  registry.addExtensions<FuncTransformDialectExtension>();
66 }
The DialectRegistry maps a dialect namespace to a constructor for the matching dialect.
void addExtensions()
Add the given extensions to the registry.
Conversion from types to the LLVM IR dialect.
Definition: TypeConverter.h:33
Type conversion class.
Base class for extensions of the Transform dialect that supports injecting operations into the Transf...
void registerTransformDialectExtension(DialectRegistry &registry)
Include the generated interface declarations.
void populateFuncToLLVMConversionPatterns(LLVMTypeConverter &converter, RewritePatternSet &patterns, const SymbolTable *symbolTable=nullptr)
Collect the patterns to convert from the Func dialect to LLVM.
Definition: FuncToLLVM.cpp:752
LogicalResult success(bool isSuccess=true)
Utility function to generate a LogicalResult.
Definition: LogicalResult.h:56
This class represents an efficient way to signal success or failure.
Definition: LogicalResult.h:26