CIRCT 21.0.0git
Loading...
Searching...
No Matches
RtgToolOptions.cpp
Go to the documentation of this file.
1//===- RtgToolOptions.cpp -------------------------------------------------===//
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/Passes.h"
14
15using namespace circt;
16using namespace circt::rtg;
17
18//===----------------------------------------------------------------------===//
19// RTG Tool Pipelines
20//===----------------------------------------------------------------------===//
21
22void rtg::populateRandomizerPipeline(mlir::PassManager &pm,
23 const RtgToolOptions &options) {
24 if (options.getVerifyPasses())
25 pm.enableVerifier(options.getVerifyPasses());
26
27 if (options.getVerbosePassExecution())
28 pm.addInstrumentation(
30 "rtgtool"));
31
32 {
33 // Initial canonicalization of the input IR.
34 auto &anyPm = pm.nestAny();
35 anyPm.addPass(mlir::createCSEPass());
36 anyPm.addPass(createSimpleCanonicalizerPass());
37 }
38
39 if (options.getOutputFormat() == RtgToolOptions::OutputFormat::MLIR)
40 return;
41
42 {
43 ElaborationPassOptions passOptions;
44 passOptions.seed = options.getSeed();
45 pm.addPass(rtg::createElaborationPass(passOptions));
46 }
47 pm.addPass(rtg::createInlineSequencesPass());
48 pm.addPass(rtg::createLowerUniqueLabelsPass());
49 pm.addNestedPass<rtg::TestOp>(rtg::createLinearScanRegisterAllocationPass());
50 {
51 auto &anyPm = pm.nestAny();
52 anyPm.addPass(mlir::createCSEPass());
53 anyPm.addPass(createSimpleCanonicalizerPass());
54 }
55
56 if (options.getOutputFormat() == RtgToolOptions::OutputFormat::ElaboratedMLIR)
57 return;
58
59 {
60 EmitRTGISAAssemblyPassOptions passOptions;
61 SmallVector<std::string> unsupported(options.getUnsupportedInstructions());
62 passOptions.unsupportedInstructions = unsupported;
63 passOptions.unsupportedInstructionsFile =
65 passOptions.splitOutput = options.getSplitOutput();
66 passOptions.path = options.getOutputPath();
67 pm.addPass(rtg::createEmitRTGISAAssemblyPass(passOptions));
68 }
69}
The set of options used to control the behavior of the RTG tool.
OutputFormat getOutputFormat() const
std::string getOutputPath() const
ArrayRef< std::string > getUnsupportedInstructions() const
std::string getUnsupportedInstructionsFile() const
bool getVerbosePassExecution() const
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
std::unique_ptr< Pass > createSimpleCanonicalizerPass()
Create a simple canonicalizer pass.
Definition Passes.cpp:15