[FIRRTL] Use reference to namepsace, instead of copying it in Parser (#2446)

Use a reference to the namespace instead of invoking the copy constructor.
The entire module body is under a single namespace, 
so it makes sense to maintain a single copy of the namespace
 and pass reference to it, instead of invoking the copy constructor
 for every statement block.
Fixes the performance regression in FirParser.
Fixes #2440
This commit is contained in:
Prithayan Barua 2022-01-12 11:04:40 -05:00 committed by GitHub
parent 564fdd2296
commit 3e8f636605
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -1526,7 +1526,7 @@ namespace {
struct FIRStmtParser : public FIRParser {
explicit FIRStmtParser(Block &blockToInsertInto,
FIRModuleContext &moduleContext,
Namespace modNameSpace)
Namespace &modNameSpace)
: FIRParser(moduleContext.getConstants(), moduleContext.getLexer()),
builder(mlir::ImplicitLocOpBuilder::atBlockEnd(
UnknownLoc::get(getContext()), &blockToInsertInto)),
@ -1619,7 +1619,7 @@ private:
// Extra information maintained across a module.
FIRModuleContext &moduleContext;
Namespace modNameSpace;
Namespace &modNameSpace;
};
} // end anonymous namespace