mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Frontend: support dumping the JIT state
Add a debugging mechanism that enables the JIT to dump the LLVM IR and object files to enable debugging the JIT. This makes it easier to debug the JIT mode failures. The idea was from Lang Hames!
This commit is contained in:
@@ -1448,9 +1448,23 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
|
||||
if (Args.hasArg(OPT_disable_concrete_type_metadata_mangled_name_accessors))
|
||||
Opts.DisableConcreteTypeMetadataMangledNameAccessors = true;
|
||||
|
||||
if (Args.hasArg(OPT_use_jit))
|
||||
if (Args.hasArg(OPT_use_jit)) {
|
||||
Opts.UseJIT = true;
|
||||
|
||||
if (const Arg *A = Args.getLastArg(OPT_dump_jit)) {
|
||||
llvm::Optional<swift::JITDebugArtifact> artifact =
|
||||
llvm::StringSwitch<llvm::Optional<swift::JITDebugArtifact>>(A->getValue())
|
||||
.Case("llvm-ir", JITDebugArtifact::LLVMIR)
|
||||
.Case("object", JITDebugArtifact::Object)
|
||||
.Default(None);
|
||||
if (!artifact) {
|
||||
Diags.diagnose(SourceLoc(), diag::error_invalid_arg_value,
|
||||
A->getOption().getName(), A->getValue());
|
||||
return true;
|
||||
}
|
||||
Opts.DumpJIT = *artifact;
|
||||
}
|
||||
}
|
||||
|
||||
for (const Arg *A : Args.filtered(OPT_verify_type_layout)) {
|
||||
Opts.VerifyTypeLayoutNames.push_back(A->getValue());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user