Skip to content

Commit 4b22178

Browse files
committed
Update LLVM.
1 parent 20f4c45 commit 4b22178

File tree

8 files changed

+61
-21
lines changed

8 files changed

+61
-21
lines changed

mk/main.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ endif
246246
######################################################################
247247

248248
# FIXME: x86-ism
249-
LLVM_COMPONENTS=x86 arm mips ipo bitreader bitwriter linker asmparser jit mcjit \
249+
LLVM_COMPONENTS=x86 arm mips ipo bitreader bitwriter linker asmparser mcjit \
250250
interpreter instrumentation
251251

252252
# Only build these LLVM tools

src/librustc/middle/trans/debuginfo.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -3164,8 +3164,7 @@ fn populate_scope_map(cx: &CrateContext,
31643164
parent_scope,
31653165
file_metadata,
31663166
loc.line as c_uint,
3167-
loc.col.to_uint() as c_uint,
3168-
0)
3167+
loc.col.to_uint() as c_uint)
31693168
};
31703169

31713170
scope_stack.push(ScopeStackEntry { scope_metadata: scope_metadata,
@@ -3290,8 +3289,7 @@ fn populate_scope_map(cx: &CrateContext,
32903289
parent_scope,
32913290
file_metadata,
32923291
loc.line as c_uint,
3293-
loc.col.to_uint() as c_uint,
3294-
0)
3292+
loc.col.to_uint() as c_uint)
32953293
};
32963294

32973295
scope_stack.push(ScopeStackEntry {

src/librustc_llvm/lib.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1747,8 +1747,7 @@ extern {
17471747
Scope: DIDescriptor,
17481748
File: DIFile,
17491749
Line: c_uint,
1750-
Col: c_uint,
1751-
Discriminator: c_uint)
1750+
Col: c_uint)
17521751
-> DILexicalBlock;
17531752

17541753
pub fn LLVMDIBuilderCreateStaticVariable(Builder: DIBuilderRef,
@@ -2179,12 +2178,10 @@ pub unsafe fn static_link_hack_this_sucks() {
21792178

21802179
LLVMRustLinkInExternalBitcode(0 as *mut _, 0 as *const _, 0 as size_t);
21812180

2182-
LLVMLinkInJIT();
21832181
LLVMLinkInMCJIT();
21842182
LLVMLinkInInterpreter();
21852183

21862184
extern {
2187-
fn LLVMLinkInJIT();
21882185
fn LLVMLinkInMCJIT();
21892186
fn LLVMLinkInInterpreter();
21902187
}

src/llvm

Submodule llvm updated 3131 files

src/rustllvm/PassWrapper.cpp

+15-3
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ LLVMRustAddAnalysisPasses(LLVMTargetMachineRef TM,
118118
LLVMPassManagerRef PMR,
119119
LLVMModuleRef M) {
120120
PassManagerBase *PM = unwrap(PMR);
121-
#if LLVM_VERSION_MINOR >= 5
121+
#if LLVM_VERSION_MINOR >= 6
122+
PM->add(new DataLayoutPass());
123+
#elif LLVM_VERSION_MINOR == 5
122124
PM->add(new DataLayoutPass(unwrap(M)));
123125
#else
124126
PM->add(new DataLayout(unwrap(M)));
@@ -187,7 +189,12 @@ LLVMRustWriteOutputFile(LLVMTargetMachineRef Target,
187189
PassManager *PM = unwrap<PassManager>(PMR);
188190

189191
std::string ErrorInfo;
190-
#if LLVM_VERSION_MINOR >= 4
192+
#if LLVM_VERSION_MINOR >= 6
193+
std::error_code EC;
194+
raw_fd_ostream OS(path, EC, sys::fs::F_None);
195+
if (EC)
196+
ErrorInfo = EC.message();
197+
#elif LLVM_VERSION_MINOR >= 4
191198
raw_fd_ostream OS(path, ErrorInfo, sys::fs::F_None);
192199
#else
193200
raw_fd_ostream OS(path, ErrorInfo, raw_fd_ostream::F_Binary);
@@ -210,7 +217,12 @@ LLVMRustPrintModule(LLVMPassManagerRef PMR,
210217
PassManager *PM = unwrap<PassManager>(PMR);
211218
std::string ErrorInfo;
212219

213-
#if LLVM_VERSION_MINOR >= 4
220+
#if LLVM_VERSION_MINOR >= 6
221+
std::error_code EC;
222+
raw_fd_ostream OS(path, EC, sys::fs::F_None);
223+
if (EC)
224+
ErrorInfo = EC.message();
225+
#elif LLVM_VERSION_MINOR >= 4
214226
raw_fd_ostream OS(path, ErrorInfo, sys::fs::F_None);
215227
#else
216228
raw_fd_ostream OS(path, ErrorInfo, raw_fd_ostream::F_Binary);

src/rustllvm/RustWrapper.cpp

+40-5
Original file line numberDiff line numberDiff line change
@@ -393,13 +393,12 @@ extern "C" LLVMValueRef LLVMDIBuilderCreateLexicalBlock(
393393
LLVMValueRef Scope,
394394
LLVMValueRef File,
395395
unsigned Line,
396-
unsigned Col,
397-
unsigned Discriminator) {
396+
unsigned Col) {
398397
return wrap(Builder->createLexicalBlock(
399398
unwrapDI<DIDescriptor>(Scope),
400399
unwrapDI<DIFile>(File), Line, Col
401-
#if LLVM_VERSION_MINOR >= 5
402-
, Discriminator
400+
#if LLVM_VERSION_MINOR == 5
401+
, 0
403402
#endif
404403
));
405404
}
@@ -415,7 +414,11 @@ extern "C" LLVMValueRef LLVMDIBuilderCreateStaticVariable(
415414
bool isLocalToUnit,
416415
LLVMValueRef Val,
417416
LLVMValueRef Decl = NULL) {
417+
#if LLVM_VERSION_MINOR == 6
418+
return wrap(Builder->createGlobalVariable(unwrapDI<DIDescriptor>(Context),
419+
#else
418420
return wrap(Builder->createStaticVariable(unwrapDI<DIDescriptor>(Context),
421+
#endif
419422
Name,
420423
LinkageName,
421424
unwrapDI<DIFile>(File),
@@ -665,11 +668,18 @@ extern "C" void LLVMWriteValueToString(LLVMValueRef Value, RustStringRef str) {
665668
extern "C" bool
666669
LLVMRustLinkInExternalBitcode(LLVMModuleRef dst, char *bc, size_t len) {
667670
Module *Dst = unwrap(dst);
671+
#if LLVM_VERSION_MINOR == 5
668672
MemoryBuffer* buf = MemoryBuffer::getMemBufferCopy(StringRef(bc, len));
669673
ErrorOr<Module *> Src = llvm::getLazyBitcodeModule(buf, Dst->getContext());
674+
#else
675+
std::unique_ptr<MemoryBuffer> buf = MemoryBuffer::getMemBufferCopy(StringRef(bc, len));
676+
ErrorOr<Module *> Src = llvm::getLazyBitcodeModule(std::move(buf), Dst->getContext());
677+
#endif
670678
if (!Src) {
671679
LLVMRustSetLastError(Src.getError().message().c_str());
680+
#if LLVM_VERSION_MINOR == 5
672681
delete buf;
682+
#endif
673683
return false;
674684
}
675685

@@ -712,12 +722,26 @@ LLVMRustOpenArchive(char *path) {
712722
return nullptr;
713723
}
714724

725+
#if LLVM_VERSION_MINOR >= 6
726+
ErrorOr<std::unique_ptr<Archive>> archive_or =
727+
Archive::create(buf_or.get()->getMemBufferRef());
728+
729+
if (!archive_or) {
730+
LLVMRustSetLastError(archive_or.getError().message().c_str());
731+
return nullptr;
732+
}
733+
734+
OwningBinary<Archive> *ret = new OwningBinary<Archive>(
735+
std::move(archive_or.get()), std::move(buf_or.get()));
736+
#else
715737
std::error_code err;
716738
Archive *ret = new Archive(std::move(buf_or.get()), err);
717739
if (err) {
718740
LLVMRustSetLastError(err.message().c_str());
719-
return NULL;
741+
return nullptr;
720742
}
743+
#endif
744+
721745
return ret;
722746
}
723747
#else
@@ -739,7 +763,14 @@ LLVMRustOpenArchive(char *path) {
739763
#endif
740764

741765
extern "C" const char*
766+
#if LLVM_VERSION_MINOR >= 6
767+
LLVMRustArchiveReadSection(OwningBinary<Archive> *ob, char *name, size_t *size) {
768+
769+
std::unique_ptr<Archive> &ar = ob->getBinary();
770+
#else
742771
LLVMRustArchiveReadSection(Archive *ar, char *name, size_t *size) {
772+
#endif
773+
743774
#if LLVM_VERSION_MINOR >= 5
744775
Archive::child_iterator child = ar->child_begin(),
745776
end = ar->child_end();
@@ -765,7 +796,11 @@ LLVMRustArchiveReadSection(Archive *ar, char *name, size_t *size) {
765796
}
766797

767798
extern "C" void
799+
#if LLVM_VERSION_MINOR >= 6
800+
LLVMRustDestroyArchive(OwningBinary<Archive> *ar) {
801+
#else
768802
LLVMRustDestroyArchive(Archive *ar) {
803+
#endif
769804
delete ar;
770805
}
771806

src/rustllvm/llvm-auto-clean-trigger

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# If this file is modified, then llvm will be forcibly cleaned and then rebuilt.
22
# The actual contents of this file do not matter, but to trigger a change on the
33
# build bots then the contents should be changed so git updates the mtime.
4-
2014-09-08
4+
2014-10-04

src/rustllvm/rustllvm.h

-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232
#include "llvm/Support/DynamicLibrary.h"
3333
#include "llvm/Support/Memory.h"
3434
#include "llvm/ExecutionEngine/ExecutionEngine.h"
35-
#include "llvm/ExecutionEngine/JIT.h"
36-
#include "llvm/ExecutionEngine/JITMemoryManager.h"
3735
#include "llvm/ExecutionEngine/MCJIT.h"
3836
#include "llvm/ExecutionEngine/Interpreter.h"
3937
#include "llvm/Target/TargetMachine.h"

0 commit comments

Comments
 (0)