Update the minimum external LLVM to 7
LLVM 7 is over a year old, which should be plenty for compatibility. The last LLVM 6 holdout was llvm-emscripten, which went away in #65501. I've also included a fix for LLVM 8 lacking `MemorySanitizerOptions`, which was broken by #66522.
This commit is contained in:
parent
fdc0011561
commit
2304c25f31
18 changed files with 16 additions and 95 deletions
|
@ -88,11 +88,7 @@ extern "C" char *LLVMRustGetLastError(void) {
|
|||
}
|
||||
|
||||
extern "C" unsigned int LLVMRustGetInstructionCount(LLVMModuleRef M) {
|
||||
#if LLVM_VERSION_GE(7, 0)
|
||||
return unwrap(M)->getInstructionCount();
|
||||
#else
|
||||
report_fatal_error("Module::getInstructionCount not available before LLVM 7");
|
||||
#endif
|
||||
}
|
||||
|
||||
extern "C" void LLVMRustSetLastError(const char *Err) {
|
||||
|
@ -761,14 +757,10 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateVariantPart(
|
|||
LLVMMetadataRef File, unsigned LineNumber, uint64_t SizeInBits,
|
||||
uint32_t AlignInBits, LLVMRustDIFlags Flags, LLVMMetadataRef Discriminator,
|
||||
LLVMMetadataRef Elements, const char *UniqueId) {
|
||||
#if LLVM_VERSION_GE(7, 0)
|
||||
return wrap(Builder->createVariantPart(
|
||||
unwrapDI<DIDescriptor>(Scope), Name, unwrapDI<DIFile>(File), LineNumber,
|
||||
SizeInBits, AlignInBits, fromRust(Flags), unwrapDI<DIDerivedType>(Discriminator),
|
||||
DINodeArray(unwrapDI<MDTuple>(Elements)), UniqueId));
|
||||
#else
|
||||
abort();
|
||||
#endif
|
||||
}
|
||||
|
||||
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateMemberType(
|
||||
|
@ -787,7 +779,6 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateVariantMemberType(
|
|||
const char *Name, LLVMMetadataRef File, unsigned LineNo, uint64_t SizeInBits,
|
||||
uint32_t AlignInBits, uint64_t OffsetInBits, LLVMValueRef Discriminant,
|
||||
LLVMRustDIFlags Flags, LLVMMetadataRef Ty) {
|
||||
#if LLVM_VERSION_GE(7, 0)
|
||||
llvm::ConstantInt* D = nullptr;
|
||||
if (Discriminant) {
|
||||
D = unwrap<llvm::ConstantInt>(Discriminant);
|
||||
|
@ -796,12 +787,6 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateVariantMemberType(
|
|||
unwrapDI<DIFile>(File), LineNo,
|
||||
SizeInBits, AlignInBits, OffsetInBits, D,
|
||||
fromRust(Flags), unwrapDI<DIType>(Ty)));
|
||||
#else
|
||||
return wrap(Builder->createMemberType(unwrapDI<DIDescriptor>(Scope), Name,
|
||||
unwrapDI<DIFile>(File), LineNo,
|
||||
SizeInBits, AlignInBits, OffsetInBits,
|
||||
fromRust(Flags), unwrapDI<DIType>(Ty)));
|
||||
#endif
|
||||
}
|
||||
|
||||
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateLexicalBlock(
|
||||
|
@ -911,18 +896,10 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateEnumerationType(
|
|||
LLVMMetadataRef File, unsigned LineNumber, uint64_t SizeInBits,
|
||||
uint32_t AlignInBits, LLVMMetadataRef Elements,
|
||||
LLVMMetadataRef ClassTy, bool IsScoped) {
|
||||
#if LLVM_VERSION_GE(7, 0)
|
||||
return wrap(Builder->createEnumerationType(
|
||||
unwrapDI<DIDescriptor>(Scope), Name, unwrapDI<DIFile>(File), LineNumber,
|
||||
SizeInBits, AlignInBits, DINodeArray(unwrapDI<MDTuple>(Elements)),
|
||||
unwrapDI<DIType>(ClassTy), "", IsScoped));
|
||||
#else
|
||||
// Ignore IsScoped on older LLVM.
|
||||
return wrap(Builder->createEnumerationType(
|
||||
unwrapDI<DIDescriptor>(Scope), Name, unwrapDI<DIFile>(File), LineNumber,
|
||||
SizeInBits, AlignInBits, DINodeArray(unwrapDI<MDTuple>(Elements)),
|
||||
unwrapDI<DIType>(ClassTy), ""));
|
||||
#endif
|
||||
}
|
||||
|
||||
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateUnionType(
|
||||
|
@ -1275,34 +1252,20 @@ extern "C" LLVMValueRef LLVMRustBuildMemCpy(LLVMBuilderRef B,
|
|||
LLVMValueRef Dst, unsigned DstAlign,
|
||||
LLVMValueRef Src, unsigned SrcAlign,
|
||||
LLVMValueRef Size, bool IsVolatile) {
|
||||
#if LLVM_VERSION_GE(7, 0)
|
||||
return wrap(unwrap(B)->CreateMemCpy(
|
||||
unwrap(Dst), DstAlign,
|
||||
unwrap(Src), SrcAlign,
|
||||
unwrap(Size), IsVolatile));
|
||||
#else
|
||||
unsigned Align = std::min(DstAlign, SrcAlign);
|
||||
return wrap(unwrap(B)->CreateMemCpy(
|
||||
unwrap(Dst), unwrap(Src),
|
||||
unwrap(Size), Align, IsVolatile));
|
||||
#endif
|
||||
}
|
||||
|
||||
extern "C" LLVMValueRef LLVMRustBuildMemMove(LLVMBuilderRef B,
|
||||
LLVMValueRef Dst, unsigned DstAlign,
|
||||
LLVMValueRef Src, unsigned SrcAlign,
|
||||
LLVMValueRef Size, bool IsVolatile) {
|
||||
#if LLVM_VERSION_GE(7, 0)
|
||||
return wrap(unwrap(B)->CreateMemMove(
|
||||
unwrap(Dst), DstAlign,
|
||||
unwrap(Src), SrcAlign,
|
||||
unwrap(Size), IsVolatile));
|
||||
#else
|
||||
unsigned Align = std::min(DstAlign, SrcAlign);
|
||||
return wrap(unwrap(B)->CreateMemMove(
|
||||
unwrap(Dst), unwrap(Src),
|
||||
unwrap(Size), Align, IsVolatile));
|
||||
#endif
|
||||
}
|
||||
|
||||
extern "C" LLVMValueRef
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue