Add driver options to swift to enable MCCAS.

To enable MCCAS, the following driver options have been added

-cas-backend: Enable MCCAS backend in swift, the option
-cache-compile-job must also be used.

-cas-backend-mode=native: Set the CAS Backend mode to emit an object
file after materializing it from the CAS.

-cas-backend-mode=casid: Emit a file with the CASID for the CAS that was
created.

-cas-backend-mode=verify: Verify that the object file created is
identical to the object file materialized from the CAS.

-cas-emit-casid-file: Emit a .casid file next to the object file when
CAS Backend is enabled.
This commit is contained in:
Shubham Sandeep Rastogi
2023-05-09 09:00:23 -07:00
parent c3b97469da
commit 3c949028e8
11 changed files with 124 additions and 26 deletions

View File

@@ -266,6 +266,10 @@ setIRGenOutputOptsFromFrontendOptions(IRGenOptions &IRGenOpts,
}
}(FrontendOpts.RequestedAction);
IRGenOpts.UseCASBackend = FrontendOpts.UseCASBackend;
IRGenOpts.CASObjMode = FrontendOpts.CASObjMode;
IRGenOpts.EmitCASIDFile = FrontendOpts.EmitCASIDFile;
// If we're in JIT mode, set the requisite flags.
if (FrontendOpts.RequestedAction == FrontendOptions::ActionType::Immediate) {
IRGenOpts.UseJIT = true;
@@ -1440,7 +1444,8 @@ static bool ParseClangImporterArgs(ClangImporterOptions &Opts,
DiagnosticEngine &Diags,
StringRef workingDirectory,
const LangOptions &LangOpts,
const FrontendOptions &FrontendOpts) {
const FrontendOptions &FrontendOpts,
bool RequiresCAS) {
using namespace options;
if (const Arg *a = Args.getLastArg(OPT_tools_directory)) {
@@ -1568,7 +1573,7 @@ static bool ParseClangImporterArgs(ClangImporterOptions &Opts,
// Forward the FrontendOptions to clang importer option so it can be
// accessed when creating clang module compilation invocation.
if (FrontendOpts.EnableCaching)
if (RequiresCAS)
Opts.CASOpts = FrontendOpts.CASOpts;
return false;
@@ -3025,7 +3030,7 @@ bool CompilerInvocation::parseArgs(
}
if (ParseClangImporterArgs(ClangImporterOpts, ParsedArgs, Diags,
workingDirectory, LangOpts, FrontendOpts)) {
workingDirectory, LangOpts, FrontendOpts, requiresCAS())) {
return true;
}