Merge pull request #30109 from CodaFi/lies-more-lies-and-statistics

[Frontend] Clean Up Usage of UnifiedStatsReporter
This commit is contained in:
Robert Widmann
2020-02-28 10:24:02 -08:00
committed by GitHub
28 changed files with 234 additions and 179 deletions

View File

@@ -404,6 +404,9 @@ class CompilerInstance {
/// Null if no tracker.
std::unique_ptr<DependencyTracker> DepTracker;
/// If there is no stats output directory by the time the
/// instance has completed its setup, this will be null.
std::unique_ptr<UnifiedStatsReporter> Stats;
mutable ModuleDecl *MainModule = nullptr;
SerializedModuleLoader *SML = nullptr;
@@ -488,6 +491,8 @@ public:
DependencyTracker *getDependencyTracker() { return DepTracker.get(); }
const DependencyTracker *getDependencyTracker() const { return DepTracker.get(); }
UnifiedStatsReporter *getStatsReporter() const { return Stats.get(); }
SILModule *getSILModule() {
return TheSILModule.get();
}
@@ -571,6 +576,7 @@ private:
bool setUpInputs();
bool setUpASTContextIfNeeded();
void setupStatsReporter();
Optional<unsigned> setUpCodeCompletionBuffer();
/// Set up all state in the CompilerInstance to process the given input file.
@@ -619,8 +625,7 @@ public:
/// \param silModule The SIL module that was generated during SILGen.
/// \param stats A stats reporter that will report optimization statistics.
/// \returns true if any errors occurred.
bool performSILProcessing(SILModule *silModule,
UnifiedStatsReporter *stats = nullptr);
bool performSILProcessing(SILModule *silModule);
private:
SourceFile *

View File

@@ -61,6 +61,7 @@ namespace swift {
class SILModule;
class SILParserTUState;
class SourceFile;
enum class SourceFileKind;
class SourceManager;
class SyntaxParseActions;
class SyntaxParsingCache;
@@ -70,7 +71,6 @@ namespace swift {
class TypeCheckerOptions;
struct TypeLoc;
class UnifiedStatsReporter;
enum class SourceFileKind;
namespace Lowering {
class TypeConverter;
@@ -286,29 +286,31 @@ namespace swift {
StringRef OutputPath);
/// Turn the given LLVM module into native code and return true on error.
bool performLLVM(const IRGenOptions &Opts, ASTContext &Ctx, llvm::Module *Module,
StringRef OutputFilename,
UnifiedStatsReporter *Stats=nullptr);
bool performLLVM(const IRGenOptions &Opts,
ASTContext &Ctx,
llvm::Module *Module,
StringRef OutputFilename);
/// Run the LLVM passes. In multi-threaded compilation this will be done for
/// multiple LLVM modules in parallel.
/// \param Diags may be null if LLVM code gen diagnostics are not required.
/// \param DiagMutex may also be null if a mutex around \p Diags is not
/// required.
/// \param Diags The Diagnostic Engine.
/// \param DiagMutex in contexts that require parallel codegen, a mutex that the
/// diagnostic engine uses to synchronize emission.
/// \param HashGlobal used with incremental LLVMCodeGen to know if a module
/// was already compiled, may be null if not desired.
/// \param Module LLVM module to code gen, required.
/// \param TargetMachine target of code gen, required.
/// \param effectiveLanguageVersion version of the language, effectively.
/// \param OutputFilename Filename for output.
bool performLLVM(const IRGenOptions &Opts, DiagnosticEngine *Diags,
bool performLLVM(const IRGenOptions &Opts,
DiagnosticEngine &Diags,
llvm::sys::Mutex *DiagMutex,
llvm::GlobalVariable *HashGlobal,
llvm::Module *Module,
llvm::TargetMachine *TargetMachine,
const version::Version &effectiveLanguageVersion,
StringRef OutputFilename,
UnifiedStatsReporter *Stats=nullptr);
UnifiedStatsReporter *Stats);
/// Dump YAML describing all fixed-size types imported from the given module.
bool performDumpTypeInfo(const IRGenOptions &Opts,