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

Method compileFileSet_

src/SourceCompile/Compiler.cpp:883–1028  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

881}
882
883bool Compiler::compileFileSet_(CompileSourceFile::Action action,
884 bool allowMultithread,
885 std::vector<CompileSourceFile*>& container) {
886 FileSystem* const fileSystem = FileSystem::getInstance();
887 const uint16_t maxThreadCount =
888 allowMultithread ? m_commandLineParser->getNbMaxTreads() : 0;
889
890 if (maxThreadCount < 1) {
891 // Single thread
892 for (CompileSourceFile* const source : container) {
893#ifdef SURELOG_WITH_PYTHON
894 source->setPythonInterp(PythonAPI::getMainInterp());
895#endif
896 bool status = compileOneFile_(source, action);
897 m_errors->appendErrors(*source->getErrorContainer());
898 m_errors->printMessages(m_commandLineParser->muteStdout());
899 if ((!status) || source->getErrorContainer()->hasFatalErrors()) {
900 return false;
901 }
902 }
903 } else if (getCommandLineParser()->useTbb() &&
904 (action != CompileSourceFile::Action::Parse)) {
905#ifdef USETBB
906 // TBB Thread management
907 if (maxThreadCount) {
908 for (CompileSourceFile* const source : container) {
909 m_taskGroup.run(FunctorCompileOneFile(source, action));
910 }
911 m_taskGroup.wait();
912 bool fatalErrors = false;
913 for (CompileSourceFile* const source : container) {
914 // Promote report to master error container
915 m_errors->appendErrors(*source->getErrorContainer());
916 if (source->getErrorContainer()->hasFatalErrors()) {
917 fatalErrors = true;
918 }
919 if (getCommandLineParser()->pythonListener()) {
920 source->shutdownPythonInterp();
921 }
922 m_errors->printMessages(m_commandLineParser->muteStdout());
923 }
924 if (fatalErrors) return false;
925 } else {
926 for (CompileSourceFile* const source : container) {
927 source->setPythonInterp(PythonAPI::getMainInterp());
928 bool status = compileOneFile_(source, action);
929 m_errors->appendErrors(*souirce->getErrorContainer());
930 m_errors->printMessages(m_commandLineParser->muteStdout());
931 if ((!status) || source->getErrorContainer()->hasFatalErrors())
932 return false;
933 }
934 }
935#endif
936 } else {
937 // Custom Thread management
938
939 // Optimize the load balance, try to even out the work in each thread by the
940 // size of the files

Callers

nothing calls this directly

Calls 15

getNbMaxTreadsMethod · 0.80
appendErrorsMethod · 0.80
printMessagesMethod · 0.80
muteStdoutMethod · 0.80
hasFatalErrorsMethod · 0.80
useTbbMethod · 0.80
pythonListenerMethod · 0.80
shutdownPythonInterpMethod · 0.80
getJobSizeMethod · 0.80
profileMethod · 0.80

Tested by

no test coverage detected