diff --git a/lib/IRGen/GenValueWitness.cpp b/lib/IRGen/GenValueWitness.cpp index df5c392b31c..12e30491912 100644 --- a/lib/IRGen/GenValueWitness.cpp +++ b/lib/IRGen/GenValueWitness.cpp @@ -1396,9 +1396,9 @@ getAddrOfKnownValueWitnessTable(IRGenModule &IGM, CanType type, bool relativeReference) { // Native PE binaries shouldn't reference data symbols across DLLs, so disable // this on Windows, unless we're forming a relative indirectable reference. - if (IGM.useDllStorage() && !relativeReference) + if (useDllStorage(IGM.Triple) && !relativeReference) return {}; - + if (auto nom = type->getAnyNominal()) { // TODO: Non-C enums have extra inhabitants and also need additional value // witnesses for their tag manipulation (except when they're empty, in diff --git a/lib/IRGen/IRGenModule.cpp b/lib/IRGen/IRGenModule.cpp index 0ccee83c1fc..efc2d3c7425 100644 --- a/lib/IRGen/IRGenModule.cpp +++ b/lib/IRGen/IRGenModule.cpp @@ -1057,10 +1057,6 @@ bool isStandardLibrary(const llvm::Module &M) { } } -bool IRGenModule::isStandardLibrary() const { - return ::isStandardLibrary(Module); -} - llvm::FunctionType *swift::getRuntimeFnType(llvm::Module &Module, llvm::ArrayRef retTypes, llvm::ArrayRef argTypes) { @@ -1293,7 +1289,7 @@ IRGenModule::createStringConstant(StringRef Str, bool willBeRelativelyAddressed, if (NAME) \ return NAME; \ NAME = Module.getOrInsertGlobal(SYM, FullExistentialTypeMetadataStructTy); \ - if (useDllStorage() && !isStandardLibrary()) \ + if (!getSwiftModule()->isStdlibModule()) \ ApplyIRLinkage(IRLinkage::ExternalImport) \ .to(cast(NAME)); \ return NAME; \ @@ -2127,8 +2123,6 @@ void IRGenModule::error(SourceLoc loc, const Twine &message) { message.toStringRef(buffer)); } -bool IRGenModule::useDllStorage() { return ::useDllStorage(Triple); } - // In embedded swift features are available independent of deployment and // runtime targets because the runtime library is always statically linked // to the program. @@ -2152,9 +2146,9 @@ bool IRGenModule::shouldPrespecializeGenericMetadata() { auto canPrespecializeTarget = (Triple.isOSDarwin() || Triple.isOSWindows() || (Triple.isOSLinux() && !(Triple.isARM() && Triple.isArch32Bit()))); - if (canPrespecializeTarget && isStandardLibrary()) { + if (canPrespecializeTarget && getSwiftModule()->isStdlibModule()) return IRGen.Opts.PrespecializeGenericMetadata; - } + auto &context = getSwiftModule()->getASTContext(); auto deploymentAvailability = AvailabilityRange::forDeploymentTarget(context); return IRGen.Opts.PrespecializeGenericMetadata && diff --git a/lib/IRGen/IRGenModule.h b/lib/IRGen/IRGenModule.h index 38976ca8ce3..070d07cb0ff 100644 --- a/lib/IRGen/IRGenModule.h +++ b/lib/IRGen/IRGenModule.h @@ -968,8 +968,6 @@ public: void fatal_unimplemented(SourceLoc, StringRef Message); void error(SourceLoc loc, const Twine &message); - bool useDllStorage(); - bool shouldPrespecializeGenericMetadata(); bool canMakeStaticObjectReadOnly(SILType objectType); @@ -1510,7 +1508,6 @@ public: llvm::Module *getModule() const; llvm::AttributeList getAllocAttrs(); llvm::Constant *getDeletedAsyncMethodErrorAsyncFunctionPointer(); - bool isStandardLibrary() const; private: llvm::Constant *EmptyTupleMetadata = nullptr; diff --git a/lib/IRGen/MetadataRequest.cpp b/lib/IRGen/MetadataRequest.cpp index 9e1812b1f70..699f24fb427 100644 --- a/lib/IRGen/MetadataRequest.cpp +++ b/lib/IRGen/MetadataRequest.cpp @@ -602,7 +602,7 @@ irgen::tryEmitConstantHeapMetadataRef(IRGenModule &IGM, ConstantReference irgen::tryEmitConstantTypeMetadataRef(IRGenModule &IGM, CanType type, SymbolReferenceKind refKind) { - if (IGM.isStandardLibrary()) + if (IGM.getSwiftModule()->isStdlibModule()) return ConstantReference(); if (isCanonicalCompleteTypeMetadataStaticallyAddressable(IGM, type)) return ConstantReference();