diff --git a/include/circt/Dialect/Arc/ArcPasses.h b/include/circt/Dialect/Arc/ArcPasses.h index 7a0df05ca3..94782ff3b5 100644 --- a/include/circt/Dialect/Arc/ArcPasses.h +++ b/include/circt/Dialect/Arc/ArcPasses.h @@ -26,15 +26,13 @@ namespace arc { #include "circt/Dialect/Arc/ArcPasses.h.inc" std::unique_ptr -createAddTapsPass(std::optional tapPorts = {}, - std::optional tapWires = {}, - std::optional tapNamedValues = {}); +createAddTapsPass(const AddTapsOptions &options = {}); std::unique_ptr createAllocateStatePass(); std::unique_ptr createArcCanonicalizerPass(); std::unique_ptr createDedupPass(); std::unique_ptr createGroupResetsAndEnablesPass(); std::unique_ptr -createInferMemoriesPass(std::optional tapPorts = {}); +createInferMemoriesPass(const InferMemoriesOptions &options = {}); std::unique_ptr createInferStatePropertiesPass(); std::unique_ptr createInlineArcsPass(); std::unique_ptr createInlineModulesPass(); diff --git a/lib/Dialect/Arc/Transforms/AddTaps.cpp b/lib/Dialect/Arc/Transforms/AddTaps.cpp index 9f3197ef8e..e043c05eb6 100644 --- a/lib/Dialect/Arc/Transforms/AddTaps.cpp +++ b/lib/Dialect/Arc/Transforms/AddTaps.cpp @@ -25,6 +25,8 @@ using namespace hw; namespace { struct AddTapsPass : public arc::impl::AddTapsBase { + using AddTapsBase::AddTapsBase; + void runOnOperation() override { getOperation().walk([&](Operation *op) { TypeSwitch(op) @@ -95,23 +97,9 @@ struct AddTapsPass : public arc::impl::AddTapsBase { value = builder.createOrFold(loc, value); builder.create(loc, value, name); } - - using AddTapsBase::tapNamedValues; - using AddTapsBase::tapPorts; - using AddTapsBase::tapWires; }; } // namespace -std::unique_ptr -arc::createAddTapsPass(std::optional tapPorts, - std::optional tapWires, - std::optional tapNamedValues) { - auto pass = std::make_unique(); - if (tapPorts) - pass->tapPorts = *tapPorts; - if (tapWires) - pass->tapWires = *tapWires; - if (tapNamedValues) - pass->tapNamedValues = *tapNamedValues; - return pass; +std::unique_ptr arc::createAddTapsPass(const AddTapsOptions &options) { + return std::make_unique(options); } diff --git a/lib/Dialect/Arc/Transforms/InferMemories.cpp b/lib/Dialect/Arc/Transforms/InferMemories.cpp index 935b1edc67..c2d55b555e 100644 --- a/lib/Dialect/Arc/Transforms/InferMemories.cpp +++ b/lib/Dialect/Arc/Transforms/InferMemories.cpp @@ -32,13 +32,13 @@ using namespace arc; namespace { struct InferMemoriesPass : public arc::impl::InferMemoriesBase { + using InferMemoriesBase::InferMemoriesBase; + void runOnOperation() override; SmallVector opsToDelete; SmallPtrSet schemaNames; DenseMap memoryParams; - - using InferMemoriesBase::tapPorts; }; } // namespace @@ -329,9 +329,6 @@ void InferMemoriesPass::runOnOperation() { } std::unique_ptr -arc::createInferMemoriesPass(std::optional tapPorts) { - auto pass = std::make_unique(); - if (tapPorts) - pass->tapPorts = *tapPorts; - return pass; +arc::createInferMemoriesPass(const InferMemoriesOptions &options) { + return std::make_unique(options); } diff --git a/tools/arcilator/arcilator.cpp b/tools/arcilator/arcilator.cpp index f2749a4556..d680184fbd 100644 --- a/tools/arcilator/arcilator.cpp +++ b/tools/arcilator/arcilator.cpp @@ -181,7 +181,7 @@ static void populatePipeline(PassManager &pm) { if (verbosePassExecutions) pm.addInstrumentation( std::make_unique>( - "fiarcilatorrtool")); + "arcilator")); // Pre-process the input such that it no longer contains any SV dialect ops // and external modules that are relevant to the arc transformation are @@ -189,10 +189,19 @@ static void populatePipeline(PassManager &pm) { if (untilReached(UntilPreprocessing)) return; pm.addPass(createLowerFirMemPass()); - pm.addPass( - arc::createAddTapsPass(observePorts, observeWires, observeNamedValues)); + { + arc::AddTapsOptions opts; + opts.tapPorts = observePorts; + opts.tapWires = observeWires; + opts.tapNamedValues = observeNamedValues; + pm.addPass(arc::createAddTapsPass(opts)); + } pm.addPass(arc::createStripSVPass()); - pm.addPass(arc::createInferMemoriesPass(observePorts)); + { + arc::InferMemoriesOptions opts; + opts.tapPorts = observePorts; + pm.addPass(arc::createInferMemoriesPass(opts)); + } pm.addPass(createCSEPass()); pm.addPass(arc::createArcCanonicalizerPass());