mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[LTO] Support LLVM LTO for IRGen and frontend
This commit adds -lto flag for frontend to enable LTO at LLVM level. When -lto=llvm given, compiler emits LLVM bitcode file instead of object file and adds index summary for LTO. In addition for ELF format, emit llvm.dependent-libraries section to embed auto linking information
This commit is contained in:
@@ -1474,6 +1474,18 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
|
||||
}
|
||||
}
|
||||
|
||||
if (const Arg *A = Args.getLastArg(options::OPT_lto)) {
|
||||
auto LLVMLTOKind =
|
||||
llvm::StringSwitch<Optional<IRGenLLVMLTOKind>>(A->getValue())
|
||||
.Case("llvm-thin", IRGenLLVMLTOKind::Thin)
|
||||
.Case("llvm-full", IRGenLLVMLTOKind::Full)
|
||||
.Default(llvm::None);
|
||||
if (LLVMLTOKind)
|
||||
Opts.LLVMLTOKind = LLVMLTOKind.getValue();
|
||||
else
|
||||
Diags.diagnose(SourceLoc(), diag::error_invalid_arg_value,
|
||||
A->getAsString(Args), A->getValue());
|
||||
}
|
||||
|
||||
if (const Arg *A = Args.getLastArg(options::OPT_sanitize_coverage_EQ)) {
|
||||
Opts.SanitizeCoverage =
|
||||
|
||||
Reference in New Issue
Block a user