From 3fb9a2a7900ffc3b8eaf0de4997b272739bf94fe Mon Sep 17 00:00:00 2001 From: Amelia Dobis Date: Wed, 7 Aug 2024 15:20:08 -0700 Subject: [PATCH] removed defered parsing for formal body --- lib/Dialect/FIRRTL/Import/FIRParser.cpp | 43 ------------------------- 1 file changed, 43 deletions(-) diff --git a/lib/Dialect/FIRRTL/Import/FIRParser.cpp b/lib/Dialect/FIRRTL/Import/FIRParser.cpp index d59e1a21b646..fe43eda3719b 100644 --- a/lib/Dialect/FIRRTL/Import/FIRParser.cpp +++ b/lib/Dialect/FIRRTL/Import/FIRParser.cpp @@ -4611,16 +4611,6 @@ struct FIRCircuitParser : public FIRParser { unsigned indent; }; - struct DeferredBodyToParse { - Block &body; - FIRLexerCursor lexerCursor; - unsigned indent; - }; - - ParseResult parseFormalBody(const SymbolTable &circuitSymTbl, - DeferredBodyToParse &defferedBody); - SmallVector deferredBodies; - ParseResult parseModuleBody(const SymbolTable &circuitSymTbl, DeferredModuleToParse &deferredModule); @@ -5165,29 +5155,6 @@ ParseResult FIRCircuitParser::parseModule(CircuitOp circuit, bool isPublic, return success(); } -ParseResult -FIRCircuitParser::parseFormalBody(const SymbolTable &circuitSymTbl, - DeferredBodyToParse &defferedBody) { - - // Create a custom lexer for formal body like in module body parser - FIRLexer formalBodyLexer(getLexer().getSourceMgr(), getContext()); - // Reset the lexer to the top of the body - defferedBody.lexerCursor.restore(formalBodyLexer); - // Reuse a module context for this as strucutre is similar - FIRModuleContext context(getConstants(), formalBodyLexer, version); - // Default namespace - hw::InnerSymbolNamespace ns; - // Create the statement parser needed to parse the body content - FIRStmtParser stmtParser(defferedBody.body, context, ns, circuitSymTbl, - version); - - // Parse the internal region - auto result = stmtParser.parseSimpleStmtBlock(defferedBody.indent); - if (failed(result)) - return result; - return success(); -} - ParseResult FIRCircuitParser::parseFormal(CircuitOp circuit, unsigned indent) { auto startLoc = getToken().getLoc(); consumeToken(FIRToken::kw_formal); @@ -5660,16 +5627,6 @@ ParseResult FIRCircuitParser::parseCircuit( if (failed(anyFailed)) return failure(); - // Next, parse all the deffered non-module bodies. - auto anyBodyFailed = mlir::failableParallelForEachN( - getContext(), 0, deferredBodies.size(), [&](size_t index) { - if (parseFormalBody(circuitSymTbl, deferredBodies[index])) - return failure(); - return success(); - }); - if (failed(anyBodyFailed)) - return failure(); - // Helper to transform a layer name specification of the form `A::B::C` into // a SymbolRefAttr. auto parseLayerName = [&](StringRef name) {