Skip to content

Commit b349e7e

Browse files
authored
[SV] Switch passes to ODS constructors, NFC (#9929)
Switch passes to ODS constructors AI-assisted-by: Codex 5.3
1 parent 59b7a3e commit b349e7e

File tree

13 files changed

+16
-71
lines changed

13 files changed

+16
-71
lines changed

include/circt/Dialect/SV/SVPasses.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,13 @@
1414
#define CIRCT_DIALECT_SV_SVPASSES_H
1515

1616
#include "mlir/Pass/Pass.h"
17-
#include "llvm/ADT/StringRef.h"
1817

1918
namespace circt {
2019
namespace sv {
2120

2221
#define GEN_PASS_DECL
2322
#include "circt/Dialect/SV/SVPasses.h.inc"
2423

25-
std::unique_ptr<mlir::Pass> createPrettifyVerilogPass();
26-
std::unique_ptr<mlir::Pass> createHWCleanupPass(bool mergeAlwaysBlocks = true);
27-
std::unique_ptr<mlir::Pass> createHWStubExternalModulesPass();
28-
std::unique_ptr<mlir::Pass> createHWLegalizeModulesPass();
29-
std::unique_ptr<mlir::Pass> createSVTraceIVerilogPass();
30-
std::unique_ptr<mlir::Pass> createHWGeneratorCalloutPass();
31-
std::unique_ptr<mlir::Pass> createHWEliminateInOutPortsPass(
32-
const HWEliminateInOutPortsOptions &options = {});
33-
std::unique_ptr<mlir::Pass> createHWExportModuleHierarchyPass();
3424
/// Generate the code for registering passes.
3525
#define GEN_PASS_REGISTRATION
3626
#include "circt/Dialect/SV/SVPasses.h.inc"

include/circt/Dialect/SV/SVPasses.td

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ def HWCleanup : Pass<"hw-cleanup", "hw::HWModuleOp"> {
2929
"true", "Allow always and always_ff blocks to be merged">
3030
];
3131

32-
let constructor = "circt::sv::createHWCleanupPass()";
3332
}
3433

3534
def HWLegalizeModules : Pass<"hw-legalize-modules", "hw::HWModuleOp"> {
@@ -42,7 +41,6 @@ def HWLegalizeModules : Pass<"hw-legalize-modules", "hw::HWModuleOp"> {
4241
constructs.
4342
}];
4443

45-
let constructor = "circt::sv::createHWLegalizeModulesPass()";
4644
}
4745

4846
def PrettifyVerilog : Pass<"prettify-verilog", "hw::HWModuleOp"> {
@@ -55,7 +53,6 @@ def PrettifyVerilog : Pass<"prettify-verilog", "hw::HWModuleOp"> {
5553
it is self contained.
5654
}];
5755

58-
let constructor = "circt::sv::createPrettifyVerilogPass()";
5956
}
6057

6158
def HWStubExternalModules : Pass<"hw-stub-external-modules",
@@ -66,7 +63,6 @@ def HWStubExternalModules : Pass<"hw-stub-external-modules",
6663
useful for linting to eliminate missing file errors.
6764
}];
6865

69-
let constructor = "circt::sv::createHWStubExternalModulesPass()";
7066
let dependentDialects = ["circt::sv::SVDialect"];
7167
}
7268

@@ -76,8 +72,6 @@ def HWGeneratorCalloutPass : Pass<"hw-generator-callout", "ModuleOp"> {
7672
This pass calls an external program for all the hw.module.generated nodes,
7773
following the description in the hw.generator.schema node.
7874
}];
79-
let constructor = "circt::sv::createHWGeneratorCalloutPass()";
80-
8175
let options = [
8276
Option<"schemaName", "schema-name", "std::string",
8377
"", "Name of the schema to process">,
@@ -95,7 +89,6 @@ def SVTraceIVerilog : Pass<"sv-trace-iverilog", "ModuleOp"> {
9589
tracing in an iverilog simulation.
9690
}];
9791

98-
let constructor = "circt::sv::createSVTraceIVerilogPass()";
9992
let dependentDialects = ["circt::sv::SVDialect"];
10093
let options = [
10194
Option<"topOnly", "top-only", "bool", "true",
@@ -116,7 +109,6 @@ def HWExportModuleHierarchy : Pass<"hw-export-module-hierarchy",
116109
sv.verbatim ops with the output_file attribute.
117110
}];
118111

119-
let constructor = "circt::sv::createHWExportModuleHierarchyPass()";
120112
let dependentDialects = ["circt::emit::EmitDialect", "circt::sv::SVDialect"];
121113
}
122114

@@ -129,7 +121,6 @@ def HWEliminateInOutPorts : Pass<"hw-eliminate-inout-ports",
129121
input and output ports at the using module, and subsequently moving the
130122
inout read- and writes to the instantiation site.
131123
}];
132-
let constructor = "circt::sv::createHWEliminateInOutPortsPass()";
133124
let dependentDialects = ["circt::sv::SVDialect"];
134125
let options = [
135126
Option<"readSuffix", "read-suffix", "std::string", "\"_rd\"",

lib/Dialect/SV/Transforms/GeneratorCallout.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ namespace {
4040
struct HWGeneratorCalloutPass
4141
: public circt::sv::impl::HWGeneratorCalloutPassBase<
4242
HWGeneratorCalloutPass> {
43+
using Base::Base;
4344
void runOnOperation() override;
4445

4546
void processGenerator(HWModuleGeneratedOp generatedModuleOp,
@@ -168,7 +169,3 @@ void HWGeneratorCalloutPass::processGenerator(
168169
extMod->setAttr("filenames", builder.getStringAttr(fileContent));
169170
generatedModuleOp.erase();
170171
}
171-
172-
std::unique_ptr<Pass> circt::sv::createHWGeneratorCalloutPass() {
173-
return std::make_unique<HWGeneratorCalloutPass>();
174-
}

lib/Dialect/SV/Transforms/HWCleanup.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ static void mergeRegions(Region *region1, Region *region2) {
101101

102102
namespace {
103103
struct HWCleanupPass : public circt::sv::impl::HWCleanupBase<HWCleanupPass> {
104+
using Base::Base;
104105
using sv::impl::HWCleanupBase<HWCleanupPass>::mergeAlwaysBlocks;
105106

106107
void runOnOperation() override;
@@ -248,9 +249,3 @@ void HWCleanupPass::runOnProceduralRegion(Region &region) {
248249
runOnRegionsInOp(op);
249250
}
250251
}
251-
252-
std::unique_ptr<Pass> circt::sv::createHWCleanupPass(bool mergeAlwaysBlocks) {
253-
auto pass = std::make_unique<HWCleanupPass>();
254-
pass->mergeAlwaysBlocks = mergeAlwaysBlocks;
255-
return pass;
256-
}

lib/Dialect/SV/Transforms/HWEliminateInOutPorts.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,3 @@ void HWEliminateInOutPortsPass::runOnOperation() {
233233
}
234234
}
235235
}
236-
237-
std::unique_ptr<Pass> circt::sv::createHWEliminateInOutPortsPass(
238-
const HWEliminateInOutPortsOptions &options) {
239-
return std::make_unique<HWEliminateInOutPortsPass>(options);
240-
}

lib/Dialect/SV/Transforms/HWExportModuleHierarchy.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,3 @@ void HWExportModuleHierarchyPass::runOnOperation() {
143143

144144
markAllAnalysesPreserved();
145145
}
146-
147-
//===----------------------------------------------------------------------===//
148-
// Pass Creation
149-
//===----------------------------------------------------------------------===//
150-
151-
std::unique_ptr<mlir::Pass> sv::createHWExportModuleHierarchyPass() {
152-
return std::make_unique<HWExportModuleHierarchyPass>();
153-
}

lib/Dialect/SV/Transforms/HWLegalizeModules.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,3 @@ void HWLegalizeModulesPass::runOnOperation() {
478478
if (!anythingChanged)
479479
markAllAnalysesPreserved();
480480
}
481-
482-
std::unique_ptr<Pass> circt::sv::createHWLegalizeModulesPass() {
483-
return std::make_unique<HWLegalizeModulesPass>();
484-
}

lib/Dialect/SV/Transforms/HWStubExternalModules.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,3 @@ void HWStubExternalModulesPass::runOnOperation() {
6161
module.erase();
6262
}
6363
}
64-
65-
std::unique_ptr<Pass> circt::sv::createHWStubExternalModulesPass() {
66-
return std::make_unique<HWStubExternalModulesPass>();
67-
}

lib/Dialect/SV/Transforms/PrettifyVerilog.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,3 @@ void PrettifyVerilogPass::runOnOperation() {
578578
if (!anythingChanged)
579579
markAllAnalysesPreserved();
580580
}
581-
582-
std::unique_ptr<Pass> circt::sv::createPrettifyVerilogPass() {
583-
return std::make_unique<PrettifyVerilogPass>();
584-
}

lib/Dialect/SV/Transforms/SVTraceIVerilog.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ namespace {
3939

4040
struct SVTraceIVerilogPass
4141
: public circt::sv::impl::SVTraceIVerilogBase<SVTraceIVerilogPass> {
42+
using Base::Base;
4243
void runOnOperation() override;
4344
};
4445

@@ -77,7 +78,3 @@ void SVTraceIVerilogPass::runOnOperation() {
7778
sv::VerbatimOp::create(builder, hwmod.getLoc(), ss.str());
7879
}
7980
}
80-
81-
std::unique_ptr<Pass> circt::sv::createSVTraceIVerilogPass() {
82-
return std::make_unique<SVTraceIVerilogPass>();
83-
}

0 commit comments

Comments
 (0)