Bump minimum required LLVM version to 6.0
This commit is contained in:
@@ -216,16 +216,11 @@ LLVMRustWriteArchive(char *Dst, size_t NumMembers,
|
||||
Members.push_back(std::move(*MOrErr));
|
||||
}
|
||||
}
|
||||
|
||||
auto Result = writeArchive(Dst, Members, WriteSymbtab, Kind, true, false);
|
||||
#if LLVM_VERSION_GE(6, 0)
|
||||
if (!Result)
|
||||
return LLVMRustResult::Success;
|
||||
LLVMRustSetLastError(toString(std::move(Result)).c_str());
|
||||
#else
|
||||
if (!Result.second)
|
||||
return LLVMRustResult::Success;
|
||||
LLVMRustSetLastError(Result.second.message().c_str());
|
||||
#endif
|
||||
|
||||
return LLVMRustResult::Failure;
|
||||
}
|
||||
|
||||
@@ -17,21 +17,15 @@
|
||||
|
||||
#include "llvm/Analysis/TargetLibraryInfo.h"
|
||||
#include "llvm/Analysis/TargetTransformInfo.h"
|
||||
#include "llvm/CodeGen/TargetSubtargetInfo.h"
|
||||
#include "llvm/IR/AutoUpgrade.h"
|
||||
#include "llvm/IR/AssemblyAnnotationWriter.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/Support/CBindingWrapping.h"
|
||||
#include "llvm/Support/FileSystem.h"
|
||||
#include "llvm/Support/Host.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Transforms/IPO/PassManagerBuilder.h"
|
||||
|
||||
#if LLVM_VERSION_GE(6, 0)
|
||||
#include "llvm/CodeGen/TargetSubtargetInfo.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#else
|
||||
#include "llvm/Target/TargetSubtargetInfo.h"
|
||||
#endif
|
||||
|
||||
#include "llvm/Transforms/IPO/AlwaysInliner.h"
|
||||
#include "llvm/Transforms/IPO/FunctionImport.h"
|
||||
#include "llvm/Transforms/Utils/FunctionImportUtils.h"
|
||||
@@ -198,13 +192,9 @@ GEN_SUBTARGETS
|
||||
|
||||
extern "C" bool LLVMRustHasFeature(LLVMTargetMachineRef TM,
|
||||
const char *Feature) {
|
||||
#if LLVM_VERSION_GE(6, 0)
|
||||
TargetMachine *Target = unwrap(TM);
|
||||
const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo();
|
||||
return MCInfo->checkFeatures(std::string("+") + Feature);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
enum class LLVMRustCodeModel {
|
||||
@@ -392,13 +382,9 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
|
||||
Options.ThreadModel = ThreadModel::Single;
|
||||
}
|
||||
|
||||
#if LLVM_VERSION_GE(6, 0)
|
||||
Options.EmitStackSizeSection = EmitStackSizeSection;
|
||||
|
||||
Optional<CodeModel::Model> CM;
|
||||
#else
|
||||
CodeModel::Model CM = CodeModel::Model::Default;
|
||||
#endif
|
||||
if (RustCM != LLVMRustCodeModel::None)
|
||||
CM = fromRust(RustCM);
|
||||
TargetMachine *TM = TheTarget->createTargetMachine(
|
||||
|
||||
@@ -297,11 +297,7 @@ extern "C" void LLVMRustRemoveFunctionAttributes(LLVMValueRef Fn,
|
||||
// enable fpmath flag UnsafeAlgebra
|
||||
extern "C" void LLVMRustSetHasUnsafeAlgebra(LLVMValueRef V) {
|
||||
if (auto I = dyn_cast<Instruction>(unwrap<Value>(V))) {
|
||||
#if LLVM_VERSION_GE(6, 0)
|
||||
I->setFast(true);
|
||||
#else
|
||||
I->setHasUnsafeAlgebra(true);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1437,7 +1433,6 @@ LLVMRustBuildVectorReduceFMax(LLVMBuilderRef B, LLVMValueRef Src, bool NoNaN) {
|
||||
return wrap(unwrap(B)->CreateFPMaxReduce(unwrap(Src), NoNaN));
|
||||
}
|
||||
|
||||
#if LLVM_VERSION_GE(6, 0)
|
||||
extern "C" LLVMValueRef
|
||||
LLVMRustBuildMinNum(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS) {
|
||||
return wrap(unwrap(B)->CreateMinNum(unwrap(LHS),unwrap(RHS)));
|
||||
@@ -1446,13 +1441,3 @@ extern "C" LLVMValueRef
|
||||
LLVMRustBuildMaxNum(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS) {
|
||||
return wrap(unwrap(B)->CreateMaxNum(unwrap(LHS),unwrap(RHS)));
|
||||
}
|
||||
#else
|
||||
extern "C" LLVMValueRef
|
||||
LLVMRustBuildMinNum(LLVMBuilderRef, LLVMValueRef, LLVMValueRef) {
|
||||
return nullptr;
|
||||
}
|
||||
extern "C" LLVMValueRef
|
||||
LLVMRustBuildMaxNum(LLVMBuilderRef, LLVMValueRef, LLVMValueRef) {
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user