Skip to content

[NFC] Add an EmitSortedSIL member to SILOptions for consistency. #29210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions include/swift/AST/SILOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ class SILOptions {
/// Whether to dump verbose SIL with scope and location information.
bool EmitVerboseSIL = false;

/// Should we sort SIL functions, vtables, witness tables, and global
/// variables by name when we print it out. This eases diffing of SIL files.
bool EmitSortedSIL = false;

/// Whether to stop the optimization pipeline after serializing SIL.
bool StopOptimizationAfterSerialization = false;

Expand Down
10 changes: 4 additions & 6 deletions include/swift/Frontend/FrontendOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,6 @@ class FrontendOptions {
/// \see ResilienceStrategy::Resilient
bool EnableLibraryEvolution = false;

/// Indicates that the frontend should emit "verbose" SIL
/// (if asked to emit SIL).
bool EmitVerboseSIL = false;

/// If set, this module is part of a mixed Objective-C/Swift framework, and
/// the Objective-C half should implicitly be visible to the Swift sources.
bool ImportUnderlyingModule = false;
Expand Down Expand Up @@ -251,8 +247,10 @@ class FrontendOptions {
/// exit.
bool PrintTargetInfo = false;

/// Should we sort SIL functions, vtables, witness tables, and global
/// variables by name when we print it out. This eases diffing of SIL files.
/// See the \ref SILOptions.EmitVerboseSIL flag.
bool EmitVerboseSIL = false;

/// See the \ref SILOptions.EmitSortedSIL flag.
bool EmitSortedSIL = false;

/// Indicates whether the dependency tracker should track system
Expand Down
1 change: 1 addition & 0 deletions lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,7 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
Opts.VerifyAll |= Args.hasArg(OPT_sil_verify_all);
Opts.DebugSerialization |= Args.hasArg(OPT_sil_debug_serialization);
Opts.EmitVerboseSIL |= Args.hasArg(OPT_emit_verbose_sil);
Opts.EmitSortedSIL |= Args.hasArg(OPT_emit_sorted_sil);
Opts.PrintInstCounts |= Args.hasArg(OPT_print_inst_counts);
if (const Arg *A = Args.getLastArg(OPT_external_pass_pipeline_filename))
Opts.ExternalPassPipelineFilename = A->getValue();
Expand Down
7 changes: 3 additions & 4 deletions lib/FrontendTool/FrontendTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,7 @@ static bool writeSIL(SILModule &SM, ModuleDecl *M, bool EmitVerboseSIL,

static bool writeSIL(SILModule &SM, const PrimarySpecificPaths &PSPs,
const CompilerInstance &Instance,
const CompilerInvocation &Invocation) {
const FrontendOptions &opts = Invocation.getFrontendOptions();
const SILOptions &opts) {
return writeSIL(SM, Instance.getMainModule(), opts.EmitVerboseSIL,
PSPs.OutputFilename, opts.EmitSortedSIL);
}
Expand Down Expand Up @@ -1509,7 +1508,7 @@ static bool performCompileStepsPostSILGen(

// We've been told to emit SIL after SILGen, so write it now.
if (Action == FrontendOptions::ActionType::EmitSILGen) {
return writeSIL(*SM, PSPs, Instance, Invocation);
return writeSIL(*SM, PSPs, Instance, Invocation.getSILOptions());
}

if (Action == FrontendOptions::ActionType::EmitSIBGen) {
Expand Down Expand Up @@ -1578,7 +1577,7 @@ static bool performCompileStepsPostSILGen(

// We've been told to write canonical SIL, so write it now.
if (Action == FrontendOptions::ActionType::EmitSIL)
return writeSIL(*SM, PSPs, Instance, Invocation);
return writeSIL(*SM, PSPs, Instance, Invocation.getSILOptions());

assert(Action >= FrontendOptions::ActionType::Immediate &&
"All actions not requiring IRGen must have been handled!");
Expand Down