Loading [MathJax]/extensions/tex2jax.js
CIRCT 21.0.0git
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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.setUseTopDownTraversal(true);
24 config.setRegionSimplificationLevel(
25 mlir::GreedySimplifyRegionLevel::Disabled);
26 return mlir::createCanonicalizerPass(config);
27}
28
30 // Inner ref: We create an inner ref verification pass to initially validate
31 // the IR, as well as after all structure-changing passes.
32 // In the future, could consider hiding this behind a flag to reduce overhead.
33 pm.addPass(hw::createVerifyInnerRefNamespacePass());
34 pm.nest<kanagawa::DesignOp>().addPass(createContainerizePass());
35 pm.addPass(hw::createVerifyInnerRefNamespacePass());
36
37 // This pass ensures that duplicate get_port calls are removed before we
38 // start tunneling - no reason to tunnel the same thing twice.
39 pm.nest<DesignOp>().nest<ContainerOp>().addPass(
41
42 pm.nest<DesignOp>().addPass(
43 createTunnelingPass(KanagawaTunnelingOptions{"", ""}));
44 pm.addPass(hw::createVerifyInnerRefNamespacePass());
45 pm.addPass(createPortrefLoweringPass());
47 // Run this again as some of the above passes may create redundant ops.
48 pm.nest<DesignOp>().nest<ContainerOp>().addPass(
50 pm.nest<DesignOp>().addPass(createCleanSelfdriversPass());
51 pm.addPass(createContainersToHWPass());
52 pm.addPass(hw::createVerifyInnerRefNamespacePass());
53}
54
56 pm.nest<kanagawa::DesignOp>()
57 .nest<kanagawa::ClassOp>()
58 .nest<kanagawa::MethodOp>()
60 pm.addPass(mlir::createMem2Reg());
61
62 // TODO @mortbopet: Add a verification pass to ensure that there are no more
63 // memref.alloca's - we want all memories to be mem2reg'able, unless they are
64 // member variable accesses.
65 // - just add it as an illegal op.
66
67 // Now, perform SSA maximizations.
68 pm.addPass(circt::createMaximizeSSAPass());
69
70 // SSA maximal form achieved. Reconstruct the Kanagawa sblocks.
71 pm.nest<kanagawa::DesignOp>()
72 .nest<kanagawa::ClassOp>()
73 .nest<kanagawa::MethodOp>()
77}
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 > createEliminateRedundantOpsPass()
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