Skip to content

Commit

Permalink
[ExportVerilog] Avoid using interface pass for PrepareForEmission, NF…
Browse files Browse the repository at this point in the history
…CI (#7168)

ODS InterfacePass generates `canScheduleOn` method with a specified interface in a header file and currently we import every pass declaration through PassesDetail.h. Gcc/clang seem to compile when there is an unknown interface class but MSVC emits an error. So this PR avoids `InterfacePass` in ODS and manually implements `canScheduleOn` in PrepareForEmission.
  • Loading branch information
uenoku authored Jun 13, 2024
1 parent ee7d59b commit 2876be2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 1 addition & 2 deletions include/circt/Conversion/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ def HWLowerInstanceChoices : Pass<"hw-lower-instance-choices",
];
}

def PrepareForEmission : InterfacePass<"prepare-for-emission",
"hw::HWEmittableModuleLike"> {
def PrepareForEmission : Pass<"prepare-for-emission"> {
let summary = "Prepare IR for ExportVerilog";
let description = [{
This pass runs only PrepareForEmission.
Expand Down
7 changes: 6 additions & 1 deletion lib/Conversion/ExportVerilog/PrepareForEmission.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1333,8 +1333,13 @@ namespace {

struct PrepareForEmissionPass
: public PrepareForEmissionBase<PrepareForEmissionPass> {

bool canScheduleOn(mlir::RegisteredOperationName opName) const final {
return opName.hasInterface<hw::HWEmittableModuleLike>();
}

void runOnOperation() override {
auto module = getOperation();
auto module = cast<hw::HWEmittableModuleLike>(getOperation());
LoweringOptions options(cast<mlir::ModuleOp>(module->getParentOp()));
if (failed(prepareHWModule(module, options)))
signalPassFailure();
Expand Down

0 comments on commit 2876be2

Please sign in to comment.