Skip to content

Commit

Permalink
[FIRRTL] Add debug prints to AssignOutputDirs, NFC
Browse files Browse the repository at this point in the history
Add some basic debugging information to the AssignOutputDirs pass.  This
indicates that the pass is running and what modules are having their
output directories updated.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
  • Loading branch information
seldridge committed Aug 22, 2024
1 parent aae37b7 commit 8278236
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/Dialect/FIRRTL/Transforms/AssignOutputDirs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "circt/Dialect/FIRRTL/FIRRTLOps.h"
#include "circt/Dialect/FIRRTL/Passes.h"
#include "circt/Dialect/HW/HWAttributes.h"
#include "circt/Support/Debug.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/SmallPtrSet.h"
Expand Down Expand Up @@ -98,6 +99,7 @@ struct AssignOutputDirsPass
} // namespace

void AssignOutputDirsPass::runOnOperation() {
LLVM_DEBUG(debugPassHeader(this) << "\n");
SmallString<64> outputDir(outputDirOption);
if (fs::make_absolute(outputDir)) {
emitError(mlir::UnknownLoc::get(&getContext()),
Expand All @@ -112,6 +114,7 @@ void AssignOutputDirsPass::runOnOperation() {

bool changed = false;

LLVM_DEBUG(llvm::dbgs() << "Updating modules:\n");
DenseSet<InstanceGraphNode *> visited;
for (auto *root : getAnalysis<InstanceGraph>()) {
for (auto *node : llvm::inverse_post_order_ext(root, visited)) {
Expand Down Expand Up @@ -149,12 +152,17 @@ void AssignOutputDirsPass::runOnOperation() {
hw::OutputFileAttr::getAsDirectory(&getContext(), moduleOutputDir);
module->setAttr("output_file", f);
changed = true;
LLVM_DEBUG({
llvm::dbgs() << " - name: " << module.getName() << "\n"
<< " directory: " << f.getFilename() << "\n";
});
}
}
}

if (!changed)
markAllAnalysesPreserved();
LLVM_DEBUG(debugFooter() << "\n");
}

std::unique_ptr<mlir::Pass>
Expand Down

0 comments on commit 8278236

Please sign in to comment.