diff options
author | Michele Scuttari <michele.scuttari@outlook.com> | 2022-08-31 10:16:29 +0200 |
---|---|---|
committer | Michele Scuttari <michele.scuttari@outlook.com> | 2022-08-31 12:28:45 +0200 |
commit | 67d0d7ac0acb0665d6a09f61278fbcf51f0114c2 (patch) | |
tree | a07b13c6569a3629ec7df57dfaa945f7d92aecf6 /mlir/lib/Transforms | |
parent | 9e842dd4bd551c42951d1a56bb9d9eef1fa6c385 (diff) | |
download | llvm-67d0d7ac0acb0665d6a09f61278fbcf51f0114c2.tar.gz |
[MLIR] Update pass declarations to new autogenerated files
The patch introduces the required changes to update the pass declarations and definitions to use the new autogenerated files and allow dropping the old infrastructure.
Reviewed By: mehdi_amini, rriddle
Differential Review: https://reviews.llvm.org/D132838
Diffstat (limited to 'mlir/lib/Transforms')
-rw-r--r-- | mlir/lib/Transforms/CSE.cpp | 11 | ||||
-rw-r--r-- | mlir/lib/Transforms/Canonicalizer.cpp | 11 | ||||
-rw-r--r-- | mlir/lib/Transforms/ControlFlowSink.cpp | 11 | ||||
-rw-r--r-- | mlir/lib/Transforms/Inliner.cpp | 11 | ||||
-rw-r--r-- | mlir/lib/Transforms/LocationSnapshot.cpp | 10 | ||||
-rw-r--r-- | mlir/lib/Transforms/LoopInvariantCodeMotion.cpp | 11 | ||||
-rw-r--r-- | mlir/lib/Transforms/OpStats.cpp | 11 | ||||
-rw-r--r-- | mlir/lib/Transforms/PassDetail.h | 21 | ||||
-rw-r--r-- | mlir/lib/Transforms/SCCP.cpp | 11 | ||||
-rw-r--r-- | mlir/lib/Transforms/StripDebugInfo.cpp | 11 | ||||
-rw-r--r-- | mlir/lib/Transforms/SymbolDCE.cpp | 11 | ||||
-rw-r--r-- | mlir/lib/Transforms/SymbolPrivatize.cpp | 11 | ||||
-rw-r--r-- | mlir/lib/Transforms/TopologicalSort.cpp | 11 | ||||
-rw-r--r-- | mlir/lib/Transforms/ViewOpGraph.cpp | 11 |
14 files changed, 106 insertions, 57 deletions
diff --git a/mlir/lib/Transforms/CSE.cpp b/mlir/lib/Transforms/CSE.cpp index 783a2260275d..959cec3c0b33 100644 --- a/mlir/lib/Transforms/CSE.cpp +++ b/mlir/lib/Transforms/CSE.cpp @@ -11,11 +11,11 @@ // //===----------------------------------------------------------------------===// -#include "PassDetail.h" +#include "mlir/Transforms/Passes.h" + #include "mlir/IR/Dominance.h" #include "mlir/Interfaces/SideEffectInterfaces.h" #include "mlir/Pass/Pass.h" -#include "mlir/Transforms/Passes.h" #include "llvm/ADT/DenseMapInfo.h" #include "llvm/ADT/Hashing.h" #include "llvm/ADT/ScopedHashTable.h" @@ -23,6 +23,11 @@ #include "llvm/Support/RecyclingAllocator.h" #include <deque> +namespace mlir { +#define GEN_PASS_DEF_CSE +#include "mlir/Transforms/Passes.h.inc" +} // namespace mlir + using namespace mlir; namespace { @@ -53,7 +58,7 @@ struct SimpleOperationInfo : public llvm::DenseMapInfo<Operation *> { namespace { /// Simple common sub-expression elimination. -struct CSE : public CSEBase<CSE> { +struct CSE : public impl::CSEBase<CSE> { /// Shared implementation of operation elimination and scoped map definitions. using AllocatorTy = llvm::RecyclingAllocator< llvm::BumpPtrAllocator, diff --git a/mlir/lib/Transforms/Canonicalizer.cpp b/mlir/lib/Transforms/Canonicalizer.cpp index 3f6dbe933b2c..a4215629a964 100644 --- a/mlir/lib/Transforms/Canonicalizer.cpp +++ b/mlir/lib/Transforms/Canonicalizer.cpp @@ -11,16 +11,21 @@ // //===----------------------------------------------------------------------===// -#include "PassDetail.h" +#include "mlir/Transforms/Passes.h" + #include "mlir/Pass/Pass.h" #include "mlir/Transforms/GreedyPatternRewriteDriver.h" -#include "mlir/Transforms/Passes.h" + +namespace mlir { +#define GEN_PASS_DEF_CANONICALIZER +#include "mlir/Transforms/Passes.h.inc" +} // namespace mlir using namespace mlir; namespace { /// Canonicalize operations in nested regions. -struct Canonicalizer : public CanonicalizerBase<Canonicalizer> { +struct Canonicalizer : public impl::CanonicalizerBase<Canonicalizer> { Canonicalizer() = default; Canonicalizer(const GreedyRewriteConfig &config, ArrayRef<std::string> disabledPatterns, diff --git a/mlir/lib/Transforms/ControlFlowSink.cpp b/mlir/lib/Transforms/ControlFlowSink.cpp index 5b0cfc269511..0fcdb9c51fa6 100644 --- a/mlir/lib/Transforms/ControlFlowSink.cpp +++ b/mlir/lib/Transforms/ControlFlowSink.cpp @@ -13,19 +13,24 @@ // //===----------------------------------------------------------------------===// -#include "PassDetail.h" +#include "mlir/Transforms/Passes.h" + #include "mlir/IR/Dominance.h" #include "mlir/Interfaces/ControlFlowInterfaces.h" #include "mlir/Interfaces/SideEffectInterfaces.h" #include "mlir/Transforms/ControlFlowSinkUtils.h" -#include "mlir/Transforms/Passes.h" #include "mlir/Transforms/SideEffectUtils.h" +namespace mlir { +#define GEN_PASS_DEF_CONTROLFLOWSINK +#include "mlir/Transforms/Passes.h.inc" +} // namespace mlir + using namespace mlir; namespace { /// A control-flow sink pass. -struct ControlFlowSink : public ControlFlowSinkBase<ControlFlowSink> { +struct ControlFlowSink : public impl::ControlFlowSinkBase<ControlFlowSink> { void runOnOperation() override; }; } // end anonymous namespace diff --git a/mlir/lib/Transforms/Inliner.cpp b/mlir/lib/Transforms/Inliner.cpp index 5ce32b14185e..1fdeeafc8ebd 100644 --- a/mlir/lib/Transforms/Inliner.cpp +++ b/mlir/lib/Transforms/Inliner.cpp @@ -13,7 +13,8 @@ // //===----------------------------------------------------------------------===// -#include "PassDetail.h" +#include "mlir/Transforms/Passes.h" + #include "mlir/Analysis/CallGraph.h" #include "mlir/IR/Threading.h" #include "mlir/Interfaces/CallInterfaces.h" @@ -21,10 +22,14 @@ #include "mlir/Pass/PassManager.h" #include "mlir/Support/DebugStringHelper.h" #include "mlir/Transforms/InliningUtils.h" -#include "mlir/Transforms/Passes.h" #include "llvm/ADT/SCCIterator.h" #include "llvm/Support/Debug.h" +namespace mlir { +#define GEN_PASS_DEF_INLINER +#include "mlir/Transforms/Passes.h.inc" +} // namespace mlir + #define DEBUG_TYPE "inlining" using namespace mlir; @@ -582,7 +587,7 @@ static LogicalResult inlineCallsInSCC(Inliner &inliner, CGUseList &useList, //===----------------------------------------------------------------------===// namespace { -class InlinerPass : public InlinerBase<InlinerPass> { +class InlinerPass : public impl::InlinerBase<InlinerPass> { public: InlinerPass(); InlinerPass(const InlinerPass &) = default; diff --git a/mlir/lib/Transforms/LocationSnapshot.cpp b/mlir/lib/Transforms/LocationSnapshot.cpp index a042d07335bb..f020be2a2206 100644 --- a/mlir/lib/Transforms/LocationSnapshot.cpp +++ b/mlir/lib/Transforms/LocationSnapshot.cpp @@ -7,13 +7,19 @@ //===----------------------------------------------------------------------===// #include "mlir/Transforms/LocationSnapshot.h" -#include "PassDetail.h" + #include "mlir/IR/AsmState.h" #include "mlir/IR/Builders.h" +#include "mlir/Pass/Pass.h" #include "mlir/Support/FileUtilities.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/ToolOutputFile.h" +namespace mlir { +#define GEN_PASS_DEF_LOCATIONSNAPSHOT +#include "mlir/Transforms/Passes.h.inc" +} // namespace mlir + using namespace mlir; /// This function generates new locations from the given IR by snapshotting the @@ -123,7 +129,7 @@ LogicalResult mlir::generateLocationsFromIR(StringRef fileName, StringRef tag, namespace { struct LocationSnapshotPass - : public LocationSnapshotBase<LocationSnapshotPass> { + : public impl::LocationSnapshotBase<LocationSnapshotPass> { LocationSnapshotPass() = default; LocationSnapshotPass(OpPrintingFlags flags, StringRef fileName, StringRef tag) : flags(flags) { diff --git a/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp b/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp index 35e0f48b2958..471193701718 100644 --- a/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp +++ b/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp @@ -10,18 +10,23 @@ // //===----------------------------------------------------------------------===// -#include "PassDetail.h" +#include "mlir/Transforms/Passes.h" + #include "mlir/Interfaces/LoopLikeInterface.h" #include "mlir/Transforms/LoopInvariantCodeMotionUtils.h" -#include "mlir/Transforms/Passes.h" #include "mlir/Transforms/SideEffectUtils.h" +namespace mlir { +#define GEN_PASS_DEF_LOOPINVARIANTCODEMOTION +#include "mlir/Transforms/Passes.h.inc" +} // namespace mlir + using namespace mlir; namespace { /// Loop invariant code motion (LICM) pass. struct LoopInvariantCodeMotion - : public LoopInvariantCodeMotionBase<LoopInvariantCodeMotion> { + : public impl::LoopInvariantCodeMotionBase<LoopInvariantCodeMotion> { void runOnOperation() override; }; } // namespace diff --git a/mlir/lib/Transforms/OpStats.cpp b/mlir/lib/Transforms/OpStats.cpp index d02cb8a3c895..6a71e1f02edc 100644 --- a/mlir/lib/Transforms/OpStats.cpp +++ b/mlir/lib/Transforms/OpStats.cpp @@ -6,19 +6,24 @@ // //===----------------------------------------------------------------------===// -#include "PassDetail.h" +#include "mlir/Transforms/Passes.h" + #include "mlir/IR/BuiltinOps.h" #include "mlir/IR/Operation.h" #include "mlir/IR/OperationSupport.h" -#include "mlir/Transforms/Passes.h" #include "llvm/ADT/DenseMap.h" #include "llvm/Support/Format.h" #include "llvm/Support/raw_ostream.h" +namespace mlir { +#define GEN_PASS_DEF_PRINTOPSTATS +#include "mlir/Transforms/Passes.h.inc" +} // namespace mlir + using namespace mlir; namespace { -struct PrintOpStatsPass : public PrintOpStatsBase<PrintOpStatsPass> { +struct PrintOpStatsPass : public impl::PrintOpStatsBase<PrintOpStatsPass> { explicit PrintOpStatsPass(raw_ostream &os) : os(os) {} explicit PrintOpStatsPass(raw_ostream &os, bool printAsJSON) : os(os) { diff --git a/mlir/lib/Transforms/PassDetail.h b/mlir/lib/Transforms/PassDetail.h deleted file mode 100644 index 7c1f53929fe4..000000000000 --- a/mlir/lib/Transforms/PassDetail.h +++ /dev/null @@ -1,21 +0,0 @@ -//===- PassDetail.h - Transforms Pass class details -------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef TRANSFORMS_PASSDETAIL_H_ -#define TRANSFORMS_PASSDETAIL_H_ - -#include "mlir/Pass/Pass.h" -#include "mlir/Pass/PassManager.h" -#include "mlir/Transforms/Passes.h" - -namespace mlir { -#define GEN_PASS_CLASSES -#include "mlir/Transforms/Passes.h.inc" -} // namespace mlir - -#endif // TRANSFORMS_PASSDETAIL_H_ diff --git a/mlir/lib/Transforms/SCCP.cpp b/mlir/lib/Transforms/SCCP.cpp index a0a06352a0e8..385ff25aeda1 100644 --- a/mlir/lib/Transforms/SCCP.cpp +++ b/mlir/lib/Transforms/SCCP.cpp @@ -14,7 +14,8 @@ // //===----------------------------------------------------------------------===// -#include "PassDetail.h" +#include "mlir/Transforms/Passes.h" + #include "mlir/Analysis/DataFlow/ConstantPropagationAnalysis.h" #include "mlir/Analysis/DataFlow/DeadCodeAnalysis.h" #include "mlir/IR/Builders.h" @@ -22,7 +23,11 @@ #include "mlir/Interfaces/SideEffectInterfaces.h" #include "mlir/Pass/Pass.h" #include "mlir/Transforms/FoldUtils.h" -#include "mlir/Transforms/Passes.h" + +namespace mlir { +#define GEN_PASS_DEF_SCCP +#include "mlir/Transforms/Passes.h.inc" +} // namespace mlir using namespace mlir; using namespace mlir::dataflow; @@ -109,7 +114,7 @@ static void rewrite(DataFlowSolver &solver, MLIRContext *context, //===----------------------------------------------------------------------===// namespace { -struct SCCP : public SCCPBase<SCCP> { +struct SCCP : public impl::SCCPBase<SCCP> { void runOnOperation() override; }; } // namespace diff --git a/mlir/lib/Transforms/StripDebugInfo.cpp b/mlir/lib/Transforms/StripDebugInfo.cpp index 99e11517b7e0..87f5f76d3d43 100644 --- a/mlir/lib/Transforms/StripDebugInfo.cpp +++ b/mlir/lib/Transforms/StripDebugInfo.cpp @@ -6,16 +6,21 @@ // //===----------------------------------------------------------------------===// -#include "PassDetail.h" +#include "mlir/Transforms/Passes.h" + #include "mlir/IR/BuiltinOps.h" #include "mlir/IR/Operation.h" #include "mlir/Pass/Pass.h" -#include "mlir/Transforms/Passes.h" + +namespace mlir { +#define GEN_PASS_DEF_STRIPDEBUGINFO +#include "mlir/Transforms/Passes.h.inc" +} // namespace mlir using namespace mlir; namespace { -struct StripDebugInfo : public StripDebugInfoBase<StripDebugInfo> { +struct StripDebugInfo : public impl::StripDebugInfoBase<StripDebugInfo> { void runOnOperation() override; }; } // namespace diff --git a/mlir/lib/Transforms/SymbolDCE.cpp b/mlir/lib/Transforms/SymbolDCE.cpp index c197f5025c46..bf85cecaa46e 100644 --- a/mlir/lib/Transforms/SymbolDCE.cpp +++ b/mlir/lib/Transforms/SymbolDCE.cpp @@ -11,14 +11,19 @@ // //===----------------------------------------------------------------------===// -#include "PassDetail.h" -#include "mlir/IR/SymbolTable.h" #include "mlir/Transforms/Passes.h" +#include "mlir/IR/SymbolTable.h" + +namespace mlir { +#define GEN_PASS_DEF_SYMBOLDCE +#include "mlir/Transforms/Passes.h.inc" +} // namespace mlir + using namespace mlir; namespace { -struct SymbolDCE : public SymbolDCEBase<SymbolDCE> { +struct SymbolDCE : public impl::SymbolDCEBase<SymbolDCE> { void runOnOperation() override; /// Compute the liveness of the symbols within the given symbol table. diff --git a/mlir/lib/Transforms/SymbolPrivatize.cpp b/mlir/lib/Transforms/SymbolPrivatize.cpp index 4aa7897da0ad..58fafa7e2b58 100644 --- a/mlir/lib/Transforms/SymbolPrivatize.cpp +++ b/mlir/lib/Transforms/SymbolPrivatize.cpp @@ -11,14 +11,19 @@ // //===----------------------------------------------------------------------===// -#include "PassDetail.h" -#include "mlir/IR/SymbolTable.h" #include "mlir/Transforms/Passes.h" +#include "mlir/IR/SymbolTable.h" + +namespace mlir { +#define GEN_PASS_DEF_SYMBOLPRIVATIZE +#include "mlir/Transforms/Passes.h.inc" +} // namespace mlir + using namespace mlir; namespace { -struct SymbolPrivatize : public SymbolPrivatizeBase<SymbolPrivatize> { +struct SymbolPrivatize : public impl::SymbolPrivatizeBase<SymbolPrivatize> { explicit SymbolPrivatize(ArrayRef<std::string> excludeSymbols); LogicalResult initialize(MLIRContext *context) override; void runOnOperation() override; diff --git a/mlir/lib/Transforms/TopologicalSort.cpp b/mlir/lib/Transforms/TopologicalSort.cpp index afa0b78fbf25..04b52259abad 100644 --- a/mlir/lib/Transforms/TopologicalSort.cpp +++ b/mlir/lib/Transforms/TopologicalSort.cpp @@ -6,14 +6,21 @@ // //===----------------------------------------------------------------------===// -#include "PassDetail.h" +#include "mlir/Transforms/Passes.h" + #include "mlir/IR/RegionKindInterface.h" #include "mlir/Transforms/TopologicalSortUtils.h" +namespace mlir { +#define GEN_PASS_DEF_TOPOLOGICALSORT +#include "mlir/Transforms/Passes.h.inc" +} // namespace mlir + using namespace mlir; namespace { -struct TopologicalSortPass : public TopologicalSortBase<TopologicalSortPass> { +struct TopologicalSortPass + : public impl::TopologicalSortBase<TopologicalSortPass> { void runOnOperation() override { // Topologically sort the regions of the operation without SSA dominance. getOperation()->walk([](RegionKindInterface op) { diff --git a/mlir/lib/Transforms/ViewOpGraph.cpp b/mlir/lib/Transforms/ViewOpGraph.cpp index 1cd0164f6dd3..9afe2f5dc00c 100644 --- a/mlir/lib/Transforms/ViewOpGraph.cpp +++ b/mlir/lib/Transforms/ViewOpGraph.cpp @@ -7,15 +7,22 @@ //===----------------------------------------------------------------------===// #include "mlir/Transforms/ViewOpGraph.h" -#include "PassDetail.h" + #include "mlir/IR/Block.h" #include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/Operation.h" +#include "mlir/Pass/Pass.h" #include "mlir/Support/IndentedOstream.h" +#include "llvm/ADT/StringMap.h" #include "llvm/Support/Format.h" #include "llvm/Support/GraphWriter.h" #include <utility> +namespace mlir { +#define GEN_PASS_DEF_VIEWOPGRAPH +#include "mlir/Transforms/Passes.h.inc" +} // namespace mlir + using namespace mlir; static const StringRef kLineStyleControlFlow = "dashed"; @@ -72,7 +79,7 @@ public: /// This pass generates a Graphviz dataflow visualization of an MLIR operation. /// Note: See https://www.graphviz.org/doc/info/lang.html for more information /// about the Graphviz DOT language. -class PrintOpPass : public ViewOpGraphBase<PrintOpPass> { +class PrintOpPass : public impl::ViewOpGraphBase<PrintOpPass> { public: PrintOpPass(raw_ostream &os) : os(os) {} PrintOpPass(const PrintOpPass &o) : PrintOpPass(o.os.getOStream()) {} |