Skip to content

Commit

Permalink
[FIRRTL] Avoid module keyword in CheckLayers, NFC
Browse files Browse the repository at this point in the history
Change uses of "module" to "moduleOp" to avoid collision with C++20.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
  • Loading branch information
seldridge committed Sep 20, 2024
1 parent d5314f7 commit afd61f2
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/Dialect/FIRRTL/Transforms/CheckLayers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ namespace firrtl {

using namespace circt;
using namespace firrtl;
using namespace mlir;

namespace {
class CheckLayers {
Expand All @@ -46,13 +47,13 @@ class CheckLayers {

/// Walk a module, reporting any illegal instantation of layers under layers,
/// and record if this module contains any layerblocks.
void run(FModuleOp module) {
void run(FModuleOp moduleOp) {
// If this module directly contains a layerblock, or instantiates another
// module with a layerblock, then this will point to the layerblock. We use
// this for error reporting. We keep track of only the first layerblock
// found.
LayerBlockOp firstLayerblock = nullptr;
module.getBodyBlock()->walk<mlir::WalkOrder::PreOrder>([&](Operation *op) {
moduleOp.getBodyBlock()->walk<WalkOrder::PreOrder>([&](Operation *op) {
// If we are instantiating a module, check if it contains a layerblock. If
// it does, mark this target layerblock as our layerblock.
if (auto instance = dyn_cast<FInstanceLike>(op)) {
Expand Down Expand Up @@ -81,7 +82,7 @@ class CheckLayers {
});
// If this module contained a layerblock, then record it.
if (firstLayerblock)
layerBlocks.try_emplace(module, firstLayerblock);
layerBlocks.try_emplace(moduleOp, firstLayerblock);
}

public:
Expand All @@ -90,8 +91,8 @@ class CheckLayers {
DenseSet<InstanceGraphNode *> visited;
for (auto *root : instanceGraph) {
for (auto *node : llvm::post_order_ext(root, visited)) {
if (auto module = dyn_cast<FModuleOp>(node->getModule<Operation *>()))
checkLayers.run(module);
if (auto moduleOp = dyn_cast<FModuleOp>(node->getModule<Operation *>()))
checkLayers.run(moduleOp);
}
}
return failure(checkLayers.error);
Expand All @@ -116,6 +117,6 @@ class CheckLayersPass
}
};

std::unique_ptr<mlir::Pass> circt::firrtl::createCheckLayers() {
std::unique_ptr<Pass> circt::firrtl::createCheckLayers() {
return std::make_unique<CheckLayersPass>();
}

0 comments on commit afd61f2

Please sign in to comment.