mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[embedded] Prefer Module.getOptions().EmbeddedSwift in SIL code
This commit is contained in:
@@ -431,8 +431,7 @@ class DeadFunctionAndGlobalElimination {
|
||||
for (SILFunction &F : *Module) {
|
||||
// In embedded Swift, generic functions, even public ones cannot be used
|
||||
// externally and are not anchors.
|
||||
bool embedded =
|
||||
Module->getASTContext().LangOpts.hasFeature(Feature::Embedded);
|
||||
bool embedded = Module->getOptions().EmbeddedSwift;
|
||||
bool generic = loweredFunctionHasGenericArguments(&F);
|
||||
bool ignoreAnchor =
|
||||
embedded && generic && removeUnspecializedFunctionsInEmbeddedSwift;
|
||||
|
||||
@@ -354,7 +354,7 @@ bool PerformanceDiagnostics::visitInst(SILInstruction *inst,
|
||||
RuntimeEffect impact = getRuntimeEffect(inst, impactType);
|
||||
LocWithParent loc(inst->getLoc().getSourceLoc(), parentLoc);
|
||||
|
||||
if (module.getASTContext().LangOpts.hasFeature(Feature::Embedded) &&
|
||||
if (module.getOptions().EmbeddedSwift &&
|
||||
impact & RuntimeEffect::Existential) {
|
||||
PrettyStackTracePerformanceDiagnostics stackTrace("existential", inst);
|
||||
diagnose(loc, diag::performance_metadata, "existential");
|
||||
@@ -507,7 +507,7 @@ bool PerformanceDiagnostics::visitInst(SILInstruction *inst,
|
||||
void PerformanceDiagnostics::checkNonAnnotatedFunction(SILFunction *function) {
|
||||
for (SILBasicBlock &block : *function) {
|
||||
for (SILInstruction &inst : block) {
|
||||
if (function->getASTContext().LangOpts.hasFeature(Feature::Embedded)) {
|
||||
if (function->getModule().getOptions().EmbeddedSwift) {
|
||||
auto loc = LocWithParent(inst.getLoc().getSourceLoc(), nullptr);
|
||||
visitInst(&inst, PerformanceConstraints::None, &loc);
|
||||
}
|
||||
@@ -607,8 +607,7 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
if (!annotatedFunctionsFound &&
|
||||
!getModule()->getASTContext().LangOpts.hasFeature(Feature::Embedded))
|
||||
if (!annotatedFunctionsFound && !getModule()->getOptions().EmbeddedSwift)
|
||||
return;
|
||||
|
||||
for (SILFunction &function : *module) {
|
||||
@@ -616,8 +615,9 @@ private:
|
||||
if (function.wasDeserializedCanonical())
|
||||
continue;
|
||||
|
||||
// Don't check generic functions, they're about to be removed anyway.
|
||||
if (getModule()->getASTContext().LangOpts.hasFeature(Feature::Embedded) &&
|
||||
// Don't check generic functions in embedded Swift, they're about to be
|
||||
// removed anyway.
|
||||
if (getModule()->getOptions().EmbeddedSwift &&
|
||||
function.getLoweredFunctionType()->getSubstGenericSignature())
|
||||
continue;
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ class VTableSpecializer : public SILModuleTransform {
|
||||
void run() override {
|
||||
SILModule &module = *getModule();
|
||||
|
||||
if (!module.getASTContext().LangOpts.hasFeature(Feature::Embedded)) return;
|
||||
if (!module.getOptions().EmbeddedSwift) return;
|
||||
|
||||
LLVM_DEBUG(llvm::dbgs() << "***** VTableSpecializer\n");
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
|
||||
// In embedded Swift, the stdlib contains all the runtime functions needed
|
||||
// (swift_retain, etc.). Link them in so they can be referenced in IRGen.
|
||||
if (M.getASTContext().LangOpts.hasFeature(Feature::Embedded)) {
|
||||
if (M.getOptions().EmbeddedSwift) {
|
||||
linkEmbeddedRuntimeFromStdlib();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user