Skip to content

Commit 8a7e955

Browse files
committed
Move -enable-sil-opaque-value to SILOptions.
1 parent 4343d94 commit 8a7e955

File tree

8 files changed

+11
-14
lines changed

8 files changed

+11
-14
lines changed

include/swift/AST/SILOptions.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ class SILOptions {
140140
/// If this is disabled we do not serialize in OSSA form when optimizing.
141141
bool EnableOSSAModules = false;
142142

143+
/// If set to true, compile with the SIL Opaque Values enabled.
144+
bool EnableSILOpaqueValues = false;
145+
143146
// The kind of function bodies to skip emitting.
144147
FunctionBodySkipping SkipFunctionBodies = FunctionBodySkipping::None;
145148

include/swift/Basic/LangOptions.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -376,11 +376,6 @@ namespace swift {
376376
/// [TODO: Clang-type-plumbing] Turn on for feature rollout.
377377
bool UseClangFunctionTypes = false;
378378

379-
/// If set to true, compile with the SIL Opaque Values enabled.
380-
/// This is for bootstrapping. It can't be in SILOptions because the
381-
/// TypeChecker uses it to set resolve the ParameterConvention.
382-
bool EnableSILOpaqueValues = false;
383-
384379
/// If set to true, the diagnosis engine can assume the emitted diagnostics
385380
/// will be used in editor. This usually leads to more aggressive fixit.
386381
bool DiagnosticsEditorMode = false;

include/swift/Option/FrontendOptions.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -504,9 +504,6 @@ def disable_sil_ownership_verifier : Flag<["-"], "disable-sil-ownership-verifier
504504
def suppress_static_exclusivity_swap : Flag<["-"], "suppress-static-exclusivity-swap">,
505505
HelpText<"Suppress static violations of exclusive access with swap()">;
506506

507-
def enable_sil_opaque_values : Flag<["-"], "enable-sil-opaque-values">,
508-
HelpText<"Enable SIL Opaque Values">;
509-
510507
def enable_experimental_static_assert :
511508
Flag<["-"], "enable-experimental-static-assert">,
512509
HelpText<"Enable experimental #assert">;
@@ -1015,6 +1012,9 @@ def enable_ossa_modules : Flag<["-"], "enable-ossa-modules">,
10151012
HelpText<"Always serialize SIL in ossa form. If this flag is not passed in, "
10161013
"when optimizing ownership will be lowered before serializing SIL">;
10171014

1015+
def enable_sil_opaque_values : Flag<["-"], "enable-sil-opaque-values">,
1016+
HelpText<"Enable SIL Opaque Values">;
1017+
10181018
def new_driver_path
10191019
: Separate<["-"], "new-driver-path">, MetaVarName<"<path>">,
10201020
HelpText<"Path of the new driver to be used">;

lib/Frontend/CompilerInvocation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,6 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
768768
Opts.EnableObjCInterop =
769769
Args.hasFlag(OPT_enable_objc_interop, OPT_disable_objc_interop,
770770
Target.isOSDarwin());
771-
Opts.EnableSILOpaqueValues |= Args.hasArg(OPT_enable_sil_opaque_values);
772771

773772
Opts.VerifyAllSubstitutionMaps |= Args.hasArg(OPT_verify_all_substitution_maps);
774773

@@ -1679,6 +1678,7 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
16791678
Opts.EnableARCOptimizations &= !Args.hasArg(OPT_disable_arc_opts);
16801679
Opts.EnableOSSAModules |= Args.hasArg(OPT_enable_ossa_modules);
16811680
Opts.EnableOSSAOptimizations &= !Args.hasArg(OPT_disable_ossa_opts);
1681+
Opts.EnableSILOpaqueValues |= Args.hasArg(OPT_enable_sil_opaque_values);
16821682
Opts.EnableSpeculativeDevirtualization |= Args.hasArg(OPT_enable_spec_devirt);
16831683
Opts.EnableActorDataRaceChecks |= Args.hasFlag(
16841684
OPT_enable_actor_data_race_checks,

lib/SIL/IR/SILType.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ SILResultInfo::getOwnershipKind(SILFunction &F,
507507

508508
SILModuleConventions::SILModuleConventions(SILModule &M)
509509
: M(&M),
510-
loweredAddresses(!M.getASTContext().LangOpts.EnableSILOpaqueValues
510+
loweredAddresses(!M.getOptions().EnableSILOpaqueValues
511511
|| M.getStage() == SILStage::Lowered)
512512
{}
513513

lib/SIL/IR/TypeLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1683,7 +1683,7 @@ namespace {
16831683

16841684
TypeLowering *handleAddressOnly(CanType type,
16851685
RecursiveProperties properties) {
1686-
if (!TC.Context.LangOpts.EnableSILOpaqueValues) {
1686+
if (!TC.Context.SILOpts.EnableSILOpaqueValues) {
16871687
auto silType = SILType::getPrimitiveAddressType(type);
16881688
return new (TC) AddressOnlyTypeLowering(silType, properties,
16891689
Expansion);

lib/SILOptimizer/Mandatory/AddressLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1527,7 +1527,7 @@ void AddressLowering::runOnFunction(SILFunction *F) {
15271527

15281528
/// The entry point to this function transformation.
15291529
void AddressLowering::run() {
1530-
if (getModule()->getASTContext().LangOpts.EnableSILOpaqueValues) {
1530+
if (getModule()->getOptions().EnableSILOpaqueValues) {
15311531
for (auto &F : *getModule())
15321532
runOnFunction(&F);
15331533
}

tools/sil-opt/SILOpt.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,8 +571,6 @@ int main(int argc, char **argv) {
571571
EnableObjCInterop ? true :
572572
DisableObjCInterop ? false : llvm::Triple(Target).isOSDarwin();
573573

574-
Invocation.getLangOptions().EnableSILOpaqueValues = EnableSILOpaqueValues;
575-
576574
Invocation.getLangOptions().OptimizationRemarkPassedPattern =
577575
createOptRemarkRegex(PassRemarksPassed);
578576
Invocation.getLangOptions().OptimizationRemarkMissedPattern =
@@ -634,6 +632,7 @@ int main(int argc, char **argv) {
634632
SILOpts.EnableSpeculativeDevirtualization = EnableSpeculativeDevirtualization;
635633
SILOpts.IgnoreAlwaysInline = IgnoreAlwaysInline;
636634
SILOpts.EnableOSSAModules = EnableOSSAModules;
635+
SILOpts.EnableSILOpaqueValues = EnableSILOpaqueValues;
637636

638637
if (CopyPropagationState) {
639638
SILOpts.CopyPropagation = *CopyPropagationState;

0 commit comments

Comments
 (0)