mirror of https://github.com/llvm/circt.git
[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:
parent
564fdd2296
commit
3e8f636605
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue