MCPcopy Create free account
hub / github.com/chipsalliance/Surelog / parseinit_

Method parseinit_

src/SourceCompile/Compiler.cpp:765–862  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

763}
764
765bool Compiler::parseinit_() {
766 Precompiled* const prec = Precompiled::getSingleton();
767
768 // Single out the large files.
769 // Small files are going to be scheduled in multiple threads based on size.
770 // Large files are going to be compiled in a different batch in multithread
771
772 if (!m_commandLineParser->fileunit()) {
773 DeleteContainerPointersAndClear(&m_symbolTables);
774 DeleteContainerPointersAndClear(&m_errorContainers);
775 }
776
777 std::vector<CompileSourceFile*> tmp_compilers;
778 for (CompileSourceFile* const compiler : m_compilers) {
779 const uint32_t nbThreads =
780 prec->isFilePrecompiled(compiler->getPpOutputFileId(),
781 compiler->getSymbolTable())
782 ? 0
783 : m_commandLineParser->getNbMaxTreads();
784
785 const int32_t effectiveNbThreads = calculateEffectiveThreads(nbThreads);
786
787 AnalyzeFile* const fileAnalyzer = new AnalyzeFile(
788 m_commandLineParser, m_design, compiler->getPpOutputFileId(),
789 compiler->getFileId(), effectiveNbThreads, m_text);
790 fileAnalyzer->analyze();
791 compiler->setFileAnalyzer(fileAnalyzer);
792 if (fileAnalyzer->getSplitFiles().size() > 1) {
793 // Schedule parent
794 m_compilersParentFiles.push_back(compiler);
795 compiler->initParser();
796
797 if (!m_commandLineParser->fileunit()) {
798 SymbolTable* symbols =
799 m_commandLineParser->getSymbolTable()->CreateSnapshot();
800 m_symbolTables.push_back(symbols);
801 compiler->setSymbolTable(symbols);
802 // fileContent->setSymbolTable(symbols);
803 ErrorContainer* errors =
804 new ErrorContainer(symbols, m_errors->getLogListener());
805 m_errorContainers.push_back(errors);
806 errors->registerCmdLine(m_commandLineParser);
807 compiler->setErrorContainer(errors);
808 }
809
810 compiler->getParser()->setFileContent(new FileContent(
811 compiler->getParser()->getFileId(0),
812 compiler->getParser()->getLibrary(), compiler->getSymbolTable(),
813 compiler->getErrorContainer(), nullptr, BadPathId));
814
815 int32_t j = 0;
816 for (const auto& ppId : fileAnalyzer->getSplitFiles()) {
817 SymbolTable* symbols =
818 m_commandLineParser->getSymbolTable()->CreateSnapshot();
819 m_symbolTables.push_back(symbols);
820 CompileSourceFile* chunkCompiler = new CompileSourceFile(
821 compiler, ppId, fileAnalyzer->getLineOffsets()[j]);
822 // Schedule chunk

Callers

nothing calls this directly

Calls 15

fileunitMethod · 0.80
isFilePrecompiledMethod · 0.80
getPpOutputFileIdMethod · 0.80
getNbMaxTreadsMethod · 0.80
analyzeMethod · 0.80
setFileAnalyzerMethod · 0.80
initParserMethod · 0.80
CreateSnapshotMethod · 0.80
getLogListenerMethod · 0.80
registerCmdLineMethod · 0.80

Tested by

no test coverage detected