Skip to content

Commit 4e6c543

Browse files
committed
driver/frontend: Add an -experimental-performance-annotations option to enable performance annotations
1 parent 8229b37 commit 4e6c543

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

include/swift/AST/SILOptions.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ class SILOptions {
7878

7979
/// Controls whether cross module optimization is enabled.
8080
bool CrossModuleOptimization = false;
81-
81+
82+
/// Enables experimental performance annotations.
83+
bool EnablePerformanceAnnotations = false;
84+
8285
/// Controls whether or not paranoid verification checks are run.
8386
bool VerifyAll = false;
8487

include/swift/Option/Options.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,10 @@ def CrossModuleOptimization : Flag<["-"], "cross-module-optimization">,
798798
Flags<[HelpHidden, FrontendOption]>,
799799
HelpText<"Perform cross-module optimization">;
800800

801+
def ExperimentalPerformanceAnnotations : Flag<["-"], "experimental-performance-annotations">,
802+
Flags<[HelpHidden, FrontendOption]>,
803+
HelpText<"Perform cross-module optimization">;
804+
801805
def RemoveRuntimeAsserts : Flag<["-"], "remove-runtime-asserts">,
802806
Flags<[FrontendOption]>,
803807
HelpText<"Remove runtime safety checks.">;

lib/Driver/ToolChains.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,9 @@ ToolChain::constructInvocation(const CompileJobAction &job,
477477
Arguments.push_back("-cross-module-optimization");
478478
}
479479

480+
if (context.Args.hasArg(options::OPT_ExperimentalPerformanceAnnotations)) {
481+
Arguments.push_back("-experimental-performance-annotations");
482+
}
480483

481484
file_types::ID remarksFileType = file_types::TY_YAMLOptRecord;
482485
// If a specific format is specified for the remarks, forward that as is.

lib/Frontend/CompilerInvocation.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,6 +1418,8 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
14181418
OPT_disable_actor_data_race_checks, /*default=*/false);
14191419
Opts.DisableSILPerfOptimizations |= Args.hasArg(OPT_disable_sil_perf_optzns);
14201420
Opts.CrossModuleOptimization |= Args.hasArg(OPT_CrossModuleOptimization);
1421+
Opts.EnablePerformanceAnnotations |=
1422+
Args.hasArg(OPT_ExperimentalPerformanceAnnotations);
14211423
Opts.VerifyAll |= Args.hasArg(OPT_sil_verify_all);
14221424
Opts.VerifyNone |= Args.hasArg(OPT_sil_verify_none);
14231425
Opts.DebugSerialization |= Args.hasArg(OPT_sil_debug_serialization);

0 commit comments

Comments
 (0)