diff options
| author | Josh Stone <jistone@redhat.com> | 2021-10-19 10:24:26 -0700 |
|---|---|---|
| committer | Josh Stone <jistone@redhat.com> | 2021-10-22 09:22:18 -0700 |
| commit | 65150af1b4841feeb8b81f1ada60de1191912590 (patch) | |
| tree | 224932be576d326b9b056bffcd236093a82d083b /compiler/rustc_llvm | |
| parent | 68a698baf6bfc61d85ce6e25122a092c60c7f21a (diff) | |
| download | rust-65150af1b4841feeb8b81f1ada60de1191912590.tar.gz rust-65150af1b4841feeb8b81f1ada60de1191912590.zip | |
Update the minimum external LLVM to 11
Diffstat (limited to 'compiler/rustc_llvm')
| -rw-r--r-- | compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp | 7 | ||||
| -rw-r--r-- | compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp | 93 | ||||
| -rw-r--r-- | compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | 14 |
3 files changed, 0 insertions, 114 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp index 35cca04b20f..8cd2bd12450 100644 --- a/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp @@ -98,10 +98,7 @@ extern "C" void LLVMRustCoverageWriteMapSectionNameToString(LLVMModuleRef M, extern "C" void LLVMRustCoverageWriteFuncSectionNameToString(LLVMModuleRef M, RustStringRef Str) { -#if LLVM_VERSION_GE(11, 0) WriteSectionNameToString(M, IPSK_covfun, Str); -// else do nothing; the `Version` check will abort codegen on the Rust side -#endif } extern "C" void LLVMRustCoverageWriteMappingVarNameToString(RustStringRef Str) { @@ -111,9 +108,5 @@ extern "C" void LLVMRustCoverageWriteMappingVarNameToString(RustStringRef Str) { } extern "C" uint32_t LLVMRustCoverageMappingVersion() { -#if LLVM_VERSION_GE(11, 0) return coverage::CovMapVersion::Version4; -#else - return coverage::CovMapVersion::Version3; -#endif } diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp index 6d2e7d25336..dcf81dd7eb5 100644 --- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp @@ -54,10 +54,6 @@ typedef struct LLVMOpaqueTargetMachine *LLVMTargetMachineRef; DEFINE_STDCXX_CONVERSION_FUNCTIONS(Pass, LLVMPassRef) DEFINE_STDCXX_CONVERSION_FUNCTIONS(TargetMachine, LLVMTargetMachineRef) -#if LLVM_VERSION_LT(11, 0) -DEFINE_STDCXX_CONVERSION_FUNCTIONS(PassManagerBuilder, - LLVMPassManagerBuilderRef) -#endif extern "C" void LLVMInitializePasses() { PassRegistry &Registry = *PassRegistry::getPassRegistry(); @@ -857,13 +853,8 @@ LLVMRustOptimizeWithNewPassManager( // PassBuilder does not create a pipeline. std::vector<std::function<void(ModulePassManager &, OptimizationLevel)>> PipelineStartEPCallbacks; -#if LLVM_VERSION_GE(11, 0) std::vector<std::function<void(ModulePassManager &, OptimizationLevel)>> OptimizerLastEPCallbacks; -#else - std::vector<std::function<void(FunctionPassManager &, OptimizationLevel)>> - OptimizerLastEPCallbacks; -#endif if (VerifyIR) { PipelineStartEPCallbacks.push_back( @@ -896,7 +887,6 @@ LLVMRustOptimizeWithNewPassManager( SanitizerOptions->SanitizeMemoryTrackOrigins, SanitizerOptions->SanitizeMemoryRecover, /*CompileKernel=*/false); -#if LLVM_VERSION_GE(11, 0) OptimizerLastEPCallbacks.push_back( [Options](ModulePassManager &MPM, OptimizationLevel Level) { #if LLVM_VERSION_GE(14, 0) @@ -907,22 +897,9 @@ LLVMRustOptimizeWithNewPassManager( MPM.addPass(createModuleToFunctionPassAdaptor(MemorySanitizerPass(Options))); } ); -#else - PipelineStartEPCallbacks.push_back( - [Options](ModulePassManager &MPM, OptimizationLevel Level) { - MPM.addPass(MemorySanitizerPass(Options)); - } - ); - OptimizerLastEPCallbacks.push_back( - [Options](FunctionPassManager &FPM, OptimizationLevel Level) { - FPM.addPass(MemorySanitizerPass(Options)); - } - ); -#endif } if (SanitizerOptions->SanitizeThread) { -#if LLVM_VERSION_GE(11, 0) OptimizerLastEPCallbacks.push_back( [](ModulePassManager &MPM, OptimizationLevel Level) { #if LLVM_VERSION_GE(14, 0) @@ -933,22 +910,9 @@ LLVMRustOptimizeWithNewPassManager( MPM.addPass(createModuleToFunctionPassAdaptor(ThreadSanitizerPass())); } ); -#else - PipelineStartEPCallbacks.push_back( - [](ModulePassManager &MPM, OptimizationLevel Level) { - MPM.addPass(ThreadSanitizerPass()); - } - ); - OptimizerLastEPCallbacks.push_back( - [](FunctionPassManager &FPM, OptimizationLevel Level) { - FPM.addPass(ThreadSanitizerPass()); - } - ); -#endif } if (SanitizerOptions->SanitizeAddress) { -#if LLVM_VERSION_GE(11, 0) OptimizerLastEPCallbacks.push_back( [SanitizerOptions](ModulePassManager &MPM, OptimizationLevel Level) { MPM.addPass(RequireAnalysisPass<ASanGlobalsMetadataAnalysis, Module>()); @@ -967,29 +931,8 @@ LLVMRustOptimizeWithNewPassManager( #endif } ); -#else - PipelineStartEPCallbacks.push_back( - [&](ModulePassManager &MPM, OptimizationLevel Level) { - MPM.addPass(RequireAnalysisPass<ASanGlobalsMetadataAnalysis, Module>()); - } - ); - OptimizerLastEPCallbacks.push_back( - [SanitizerOptions](FunctionPassManager &FPM, OptimizationLevel Level) { - FPM.addPass(AddressSanitizerPass( - /*CompileKernel=*/false, SanitizerOptions->SanitizeAddressRecover, - /*UseAfterScope=*/true)); - } - ); - PipelineStartEPCallbacks.push_back( - [SanitizerOptions](ModulePassManager &MPM, OptimizationLevel Level) { - MPM.addPass(ModuleAddressSanitizerPass( - /*CompileKernel=*/false, SanitizerOptions->SanitizeAddressRecover)); - } - ); -#endif } if (SanitizerOptions->SanitizeHWAddress) { -#if LLVM_VERSION_GE(11, 0) OptimizerLastEPCallbacks.push_back( [SanitizerOptions](ModulePassManager &MPM, OptimizationLevel Level) { #if LLVM_VERSION_GE(14, 0) @@ -1003,14 +946,6 @@ LLVMRustOptimizeWithNewPassManager( #endif } ); -#else - PipelineStartEPCallbacks.push_back( - [SanitizerOptions](ModulePassManager &MPM, OptimizationLevel Level) { - MPM.addPass(HWAddressSanitizerPass( - /*CompileKernel=*/false, SanitizerOptions->SanitizeHWAddressRecover)); - } - ); -#endif } } @@ -1037,17 +972,8 @@ LLVMRustOptimizeWithNewPassManager( for (const auto &C : PipelineStartEPCallbacks) C(MPM, OptLevel); -# if LLVM_VERSION_GE(11, 0) for (const auto &C : OptimizerLastEPCallbacks) C(MPM, OptLevel); -# else - if (!OptimizerLastEPCallbacks.empty()) { - FunctionPassManager FPM(DebugPassManager); - for (const auto &C : OptimizerLastEPCallbacks) - C(FPM, OptLevel); - MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM))); - } -# endif MPM.addPass(AlwaysInlinerPass(EmitLifetimeMarkers)); @@ -1088,17 +1014,8 @@ LLVMRustOptimizeWithNewPassManager( #else MPM = PB.buildThinLTOPreLinkDefaultPipeline(OptLevel, DebugPassManager); #endif -#if LLVM_VERSION_GE(11, 0) for (const auto &C : OptimizerLastEPCallbacks) C(MPM, OptLevel); -#else - if (!OptimizerLastEPCallbacks.empty()) { - FunctionPassManager FPM(DebugPassManager); - for (const auto &C : OptimizerLastEPCallbacks) - C(FPM, OptLevel); - MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM))); - } -#endif break; case LLVMRustOptStage::PreLinkFatLTO: #if LLVM_VERSION_GE(12, 0) @@ -1552,7 +1469,6 @@ LLVMRustFreeThinLTOData(LLVMRustThinLTOData *Data) { // `ProcessThinLTOModule` function. Here they're split up into separate steps // so rustc can save off the intermediate bytecode between each step. -#if LLVM_VERSION_GE(11, 0) static bool clearDSOLocalOnDeclarations(Module &Mod, TargetMachine &TM) { // When linking an ELF shared object, dso_local should be dropped. We @@ -1563,7 +1479,6 @@ clearDSOLocalOnDeclarations(Module &Mod, TargetMachine &TM) { Mod.getPIELevel() == PIELevel::Default; return ClearDSOLocalOnDeclarations; } -#endif extern "C" bool LLVMRustPrepareThinLTORename(const LLVMRustThinLTOData *Data, LLVMModuleRef M, @@ -1571,12 +1486,8 @@ LLVMRustPrepareThinLTORename(const LLVMRustThinLTOData *Data, LLVMModuleRef M, Module &Mod = *unwrap(M); TargetMachine &Target = *unwrap(TM); -#if LLVM_VERSION_GE(11, 0) bool ClearDSOLocal = clearDSOLocalOnDeclarations(Mod, Target); bool error = renameModuleForThinLTO(Mod, Data->Index, ClearDSOLocal); -#else - bool error = renameModuleForThinLTO(Mod, Data->Index); -#endif if (error) { LLVMRustSetLastError("renameModuleForThinLTO failed"); @@ -1645,12 +1556,8 @@ LLVMRustPrepareThinLTOImport(const LLVMRustThinLTOData *Data, LLVMModuleRef M, return MOrErr; }; -#if LLVM_VERSION_GE(11, 0) bool ClearDSOLocal = clearDSOLocalOnDeclarations(Mod, Target); FunctionImporter Importer(Data->Index, Loader, ClearDSOLocal); -#else - FunctionImporter Importer(Data->Index, Loader); -#endif Expected<bool> Result = Importer.importFunctions(Mod, ImportList); if (!Result) { LLVMRustSetLastError(toString(Result.takeError()).c_str()); diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp index b7b0524e2a3..3ce98b177ad 100644 --- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp @@ -681,10 +681,8 @@ static Optional<DIFile::ChecksumKind> fromRust(LLVMRustChecksumKind Kind) { return DIFile::ChecksumKind::CSK_MD5; case LLVMRustChecksumKind::SHA1: return DIFile::ChecksumKind::CSK_SHA1; -#if (LLVM_VERSION_MAJOR >= 11) case LLVMRustChecksumKind::SHA256: return DIFile::ChecksumKind::CSK_SHA256; -#endif default: report_fatal_error("bad ChecksumKind."); } @@ -999,14 +997,9 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateUnionType( extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateTemplateTypeParameter( LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, size_t NameLen, LLVMMetadataRef Ty) { -#if LLVM_VERSION_GE(11, 0) bool IsDefault = false; // FIXME: should we ever set this true? return wrap(Builder->createTemplateTypeParameter( unwrapDI<DIDescriptor>(Scope), StringRef(Name, NameLen), unwrapDI<DIType>(Ty), IsDefault)); -#else - return wrap(Builder->createTemplateTypeParameter( - unwrapDI<DIDescriptor>(Scope), StringRef(Name, NameLen), unwrapDI<DIType>(Ty))); -#endif } extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateNameSpace( @@ -1246,23 +1239,16 @@ extern "C" LLVMTypeKind LLVMRustGetTypeKind(LLVMTypeRef Ty) { return LLVMArrayTypeKind; case Type::PointerTyID: return LLVMPointerTypeKind; -#if LLVM_VERSION_GE(11, 0) case Type::FixedVectorTyID: return LLVMVectorTypeKind; -#else - case Type::VectorTyID: - return LLVMVectorTypeKind; -#endif case Type::X86_MMXTyID: return LLVMX86_MMXTypeKind; case Type::TokenTyID: return LLVMTokenTypeKind; -#if LLVM_VERSION_GE(11, 0) case Type::ScalableVectorTyID: return LLVMScalableVectorTypeKind; case Type::BFloatTyID: return LLVMBFloatTypeKind; -#endif #if LLVM_VERSION_GE(12, 0) case Type::X86_AMXTyID: return LLVMX86_AMXTypeKind; |
