mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
IRGen: simplify the stdlib special casing for Windows
Remove `IRGenModule::useDllStorage()` as there is a standalone version that is available and the necessary information is public from the `IRGenModule` type. Additionally, avoid the wrapped `isStandardLibrary` preferring to use the same method off of the public accessors. This works towards removing some of the standard library special casing so that it is possible to support both static and dynamic standard libraries on Windows.
This commit is contained in:
@@ -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<llvm::Type*> retTypes,
|
||||
llvm::ArrayRef<llvm::Type*> 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<llvm::GlobalVariable>(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 &&
|
||||
|
||||
Reference in New Issue
Block a user