[Frontend] Emit tbd as an extra output, not a frontend action.

This means it can be emitted during an -emit-module frontend job, which is the
most common place it will be used, so reusing work like this is important for
performance.

For now, this has to happen as part of a single frontend invocation, i.e. -wmo
or -force-single-frontend-invocation.
This commit is contained in:
Huon Wilson
2017-07-26 17:33:30 -07:00
parent cb6b3123bf
commit dfa8501e59
8 changed files with 44 additions and 35 deletions

View File

@@ -742,12 +742,12 @@ static bool performCompile(CompilerInstance &Instance,
return Context.hadError();
}
if (Action == FrontendOptions::EmitTBD) {
if (!opts.TBDPath.empty()) {
const auto &silOpts = Invocation.getSILOptions();
auto hasMultipleIRGenThreads = silOpts.NumThreads > 1;
return writeTBD(Instance.getMainModule(), hasMultipleIRGenThreads,
silOpts.SILSerializeWitnessTables,
opts.getSingleOutputFilename());
if (writeTBD(Instance.getMainModule(), hasMultipleIRGenThreads,
silOpts.SILSerializeWitnessTables, opts.TBDPath))
return true;
}
assert(Action >= FrontendOptions::EmitSILGen &&