CIRCT 20.0.0git
Loading...
Searching...
No Matches
KanagawaPassPipelines.cpp
Go to the documentation of this file.
1//===- KanagawaPassPipelines.cpp - Kanagawa pass pipelines ----------------===//
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
13#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
14#include "mlir/Transforms/Passes.h"
15
16using namespace mlir;
17using namespace circt;
18using namespace kanagawa;
19
20/// Create a simple canonicalizer pass.
21static std::unique_ptr<Pass> createSimpleCanonicalizerPass() {
22 mlir::GreedyRewriteConfig config;
23 config.useTopDownTraversal = true;
24 config.enableRegionSimplification = mlir::GreedySimplifyRegionLevel::Disabled;
25 return mlir::createCanonicalizerPass(config);
26}
27
29 // Inner ref: We create an inner ref verification pass to initially validate
30 // the IR, as well as after all structure-changing passes.
31 // In the future, could consider hiding this behind a flag to reduce overhead.
32 pm.addPass(hw::createVerifyInnerRefNamespacePass());
33 pm.nest<kanagawa::DesignOp>().addPass(createContainerizePass());
34 pm.addPass(hw::createVerifyInnerRefNamespacePass());
35
36 // Pre-tunneling CSE pass. This ensures that duplicate get_port calls are
37 // removed before we start tunneling - no reason to tunnel the same thing
38 // twice.
39 pm.addPass(mlir::createCSEPass());
40 pm.nest<DesignOp>().addPass(
41 createTunnelingPass(KanagawaTunnelingOptions{"", ""}));
42 pm.addPass(hw::createVerifyInnerRefNamespacePass());
43 pm.addPass(createPortrefLoweringPass());
45 pm.nest<DesignOp>().addPass(createCleanSelfdriversPass());
46 pm.addPass(createContainersToHWPass());
47 pm.addPass(hw::createVerifyInnerRefNamespacePass());
48}
49
51 pm.nest<kanagawa::DesignOp>()
52 .nest<kanagawa::ClassOp>()
53 .nest<kanagawa::MethodOp>()
55 pm.addPass(mlir::createMem2Reg());
56
57 // TODO @mortbopet: Add a verification pass to ensure that there are no more
58 // memref.alloca's - we want all memories to be mem2reg'able, unless they are
59 // member variable accesses.
60 // - just add it as an illegal op.
61
62 // Now, perform SSA maximizations.
63 pm.addPass(circt::createMaximizeSSAPass());
64
65 // SSA maximal form achieved. Reconstruct the Kanagawa sblocks.
66 pm.nest<kanagawa::DesignOp>()
67 .nest<kanagawa::ClassOp>()
68 .nest<kanagawa::MethodOp>()
72}
std::unique_ptr< mlir::Pass > createContainersToHWPass()
void loadKanagawaLowLevelPassPipeline(mlir::PassManager &pm)
std::unique_ptr< mlir::Pass > createReblockPass()
std::unique_ptr< mlir::Pass > createInlineSBlocksPass()
std::unique_ptr< mlir::Pass > createArgifyBlocksPass()
std::unique_ptr< mlir::Pass > createContainerizePass()
std::unique_ptr< mlir::Pass > createTunnelingPass(const KanagawaTunnelingOptions &={})
std::unique_ptr< mlir::Pass > createPortrefLoweringPass()
void loadKanagawaHighLevelPassPipeline(mlir::PassManager &pm)
std::unique_ptr< mlir::Pass > createCleanSelfdriversPass()
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
std::unique_ptr< mlir::Pass > createMaximizeSSAPass()
std::unique_ptr< Pass > createSimpleCanonicalizerPass()
Create a simple canonicalizer pass.
Definition Passes.cpp:15