fully exploited the dropped support of LLVM 8
This commit grepped for LLVM_VERSION_GE, LLVM_VERSION_LT, get_major_version and min-llvm-version and statically evaluated every expression possible (and sensible) assuming that the LLVM version is >=9 now
This commit is contained in:
parent
6830f1c6e2
commit
b51bcc72d9
9 changed files with 8 additions and 73 deletions
|
@ -16,9 +16,7 @@
|
|||
#include "llvm/Object/ObjectFile.h"
|
||||
#include "llvm/Object/IRObjectFile.h"
|
||||
#include "llvm/Passes/PassBuilder.h"
|
||||
#if LLVM_VERSION_GE(9, 0)
|
||||
#include "llvm/Passes/StandardInstrumentations.h"
|
||||
#endif
|
||||
#include "llvm/Support/CBindingWrapping.h"
|
||||
#include "llvm/Support/FileSystem.h"
|
||||
#include "llvm/Support/Host.h"
|
||||
|
@ -31,15 +29,11 @@
|
|||
#include "llvm-c/Transforms/PassManagerBuilder.h"
|
||||
|
||||
#include "llvm/Transforms/Instrumentation.h"
|
||||
#if LLVM_VERSION_GE(9, 0)
|
||||
#include "llvm/Transforms/Instrumentation/AddressSanitizer.h"
|
||||
#include "llvm/Support/TimeProfiler.h"
|
||||
#endif
|
||||
#include "llvm/Transforms/Instrumentation/ThreadSanitizer.h"
|
||||
#include "llvm/Transforms/Instrumentation/MemorySanitizer.h"
|
||||
#if LLVM_VERSION_GE(9, 0)
|
||||
#include "llvm/Transforms/Utils/CanonicalizeAliases.h"
|
||||
#endif
|
||||
#include "llvm/Transforms/Utils/NameAnonGlobals.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
@ -73,20 +67,18 @@ extern "C" void LLVMTimeTraceProfilerInitialize() {
|
|||
timeTraceProfilerInitialize(
|
||||
/* TimeTraceGranularity */ 0,
|
||||
/* ProcName */ "rustc");
|
||||
#elif LLVM_VERSION_GE(9, 0)
|
||||
#else
|
||||
timeTraceProfilerInitialize();
|
||||
#endif
|
||||
}
|
||||
|
||||
extern "C" void LLVMTimeTraceProfilerFinish(const char* FileName) {
|
||||
#if LLVM_VERSION_GE(9, 0)
|
||||
StringRef FN(FileName);
|
||||
std::error_code EC;
|
||||
raw_fd_ostream OS(FN, EC, sys::fs::CD_CreateAlways);
|
||||
|
||||
timeTraceProfilerWrite(OS);
|
||||
timeTraceProfilerCleanup();
|
||||
#endif
|
||||
}
|
||||
|
||||
enum class LLVMRustPassKind {
|
||||
|
@ -127,22 +119,14 @@ extern "C" LLVMPassRef LLVMRustCreateAddressSanitizerFunctionPass(bool Recover)
|
|||
extern "C" LLVMPassRef LLVMRustCreateModuleAddressSanitizerPass(bool Recover) {
|
||||
const bool CompileKernel = false;
|
||||
|
||||
#if LLVM_VERSION_GE(9, 0)
|
||||
return wrap(createModuleAddressSanitizerLegacyPassPass(CompileKernel, Recover));
|
||||
#else
|
||||
return wrap(createAddressSanitizerModulePass(CompileKernel, Recover));
|
||||
#endif
|
||||
}
|
||||
|
||||
extern "C" LLVMPassRef LLVMRustCreateMemorySanitizerPass(int TrackOrigins, bool Recover) {
|
||||
#if LLVM_VERSION_GE(9, 0)
|
||||
const bool CompileKernel = false;
|
||||
|
||||
return wrap(createMemorySanitizerLegacyPassPass(
|
||||
MemorySanitizerOptions{TrackOrigins, Recover, CompileKernel}));
|
||||
#else
|
||||
return wrap(createMemorySanitizerLegacyPassPass(TrackOrigins, Recover));
|
||||
#endif
|
||||
}
|
||||
|
||||
extern "C" LLVMPassRef LLVMRustCreateThreadSanitizerPass() {
|
||||
|
@ -657,8 +641,6 @@ extern "C" typedef void (*LLVMRustSelfProfileBeforePassCallback)(void*, // LlvmS
|
|||
const char*); // IR name
|
||||
extern "C" typedef void (*LLVMRustSelfProfileAfterPassCallback)(void*); // LlvmSelfProfiler
|
||||
|
||||
#if LLVM_VERSION_GE(9, 0)
|
||||
|
||||
std::string LLVMRustwrappedIrGetName(const llvm::Any &WrappedIr) {
|
||||
if (any_isa<const Module *>(WrappedIr))
|
||||
return any_cast<const Module *>(WrappedIr)->getName().str();
|
||||
|
@ -706,7 +688,6 @@ void LLVMSelfProfileInitializeCallbacks(
|
|||
AfterPassCallback(LlvmSelfProfiler);
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
enum class LLVMRustOptStage {
|
||||
PreLinkNoLTO,
|
||||
|
@ -739,7 +720,6 @@ LLVMRustOptimizeWithNewPassManager(
|
|||
void* LlvmSelfProfiler,
|
||||
LLVMRustSelfProfileBeforePassCallback BeforePassCallback,
|
||||
LLVMRustSelfProfileAfterPassCallback AfterPassCallback) {
|
||||
#if LLVM_VERSION_GE(9, 0)
|
||||
Module *TheModule = unwrap(ModuleRef);
|
||||
TargetMachine *TM = unwrap(TMRef);
|
||||
PassBuilder::OptimizationLevel OptLevel = fromRust(OptLevelRust);
|
||||
|
@ -970,11 +950,6 @@ LLVMRustOptimizeWithNewPassManager(
|
|||
UpgradeCallsToIntrinsic(&*I++); // must be post-increment, as we remove
|
||||
|
||||
MPM.run(*TheModule, MAM);
|
||||
#else
|
||||
// The new pass manager has been available for a long time,
|
||||
// but we don't bother supporting it on old LLVM versions.
|
||||
report_fatal_error("New pass manager only supported since LLVM 9");
|
||||
#endif
|
||||
}
|
||||
|
||||
// Callback to demangle function name
|
||||
|
@ -1325,12 +1300,9 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules,
|
|||
GlobalValue::LinkageTypes NewLinkage) {
|
||||
Ret->ResolvedODR[ModuleIdentifier][GUID] = NewLinkage;
|
||||
};
|
||||
#if LLVM_VERSION_GE(9, 0)
|
||||
|
||||
thinLTOResolvePrevailingInIndex(Ret->Index, isPrevailing, recordNewLinkage,
|
||||
Ret->GUIDPreservedSymbols);
|
||||
#else
|
||||
thinLTOResolvePrevailingInIndex(Ret->Index, isPrevailing, recordNewLinkage);
|
||||
#endif
|
||||
|
||||
// Here we calculate an `ExportedGUIDs` set for use in the `isExported`
|
||||
// callback below. This callback below will dictate the linkage for all
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue