MLIR  16.0.0git
Bufferize.cpp
Go to the documentation of this file.
1 //===- Bufferize.cpp - scf bufferize pass ---------------------------------===//
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 #include "PassDetail.h"
17 
18 using namespace mlir;
19 using namespace mlir::scf;
20 
21 namespace {
22 struct SCFBufferizePass : public SCFBufferizeBase<SCFBufferizePass> {
23  void runOnOperation() override {
24  auto func = getOperation();
25  auto *context = &getContext();
26 
28  RewritePatternSet patterns(context);
29  ConversionTarget target(*context);
30 
33  target);
34  if (failed(applyPartialConversion(func, target, std::move(patterns))))
35  return signalPassFailure();
36  };
37 };
38 } // namespace
39 
40 std::unique_ptr<Pass> mlir::createSCFBufferizePass() {
41  return std::make_unique<SCFBufferizePass>();
42 }
Include the generated interface declarations.
LogicalResult applyPartialConversion(ArrayRef< Operation *> ops, ConversionTarget &target, const FrozenRewritePatternSet &patterns, DenseSet< Operation *> *unconvertedOps=nullptr)
Below we define several entry points for operation conversion.
void populateSCFStructuralTypeConversionsAndLegality(TypeConverter &typeConverter, RewritePatternSet &patterns, ConversionTarget &target)
Populates patterns for SCF structural type conversions and sets up the provided ConversionTarget with...
bool failed(LogicalResult result)
Utility function that returns true if the provided LogicalResult corresponds to a failure value...
Definition: LogicalResult.h:72
A helper type converter class that automatically populates the relevant materializations and type con...
Definition: Bufferize.h:33
void populateBufferizeMaterializationLegality(ConversionTarget &target)
Marks ops used by bufferization for type conversion materializations as "legal" in the given Conversi...
Definition: Bufferize.cpp:80
This class describes a specific conversion target.
std::unique_ptr< Pass > createSCFBufferizePass()
Creates a pass that bufferizes the SCF dialect.
Definition: Bufferize.cpp:40