LLVM_OPTS="$LLVM_OPTS --disable-terminfo"
# Try to have LLVM pull in as few dependencies as possible (#9397)
LLVM_OPTS="$LLVM_OPTS --disable-zlib --disable-libffi"
- # LLVM says it needs a "new" clang/gcc, but we seem to get by ok with
- # older versions on the bots. Get by for a little longer by asking it to
- # not do version detection
- LLVM_OPTS="$LLVM_OPTS --disable-compiler-version-checks"
# Use win32 native thread/lock apis instead of pthread wrapper.
# (llvm's configure tries to find pthread first, so we have to disable it explicitly.)
LHS: ValueRef,
CMP: ValueRef,
RHS: ValueRef,
- Order: AtomicOrdering)
+ Order: AtomicOrdering,
+ FailureOrder: AtomicOrdering)
-> ValueRef;
pub fn LLVMBuildAtomicRMW(B: BuilderRef,
Op: AtomicBinOp,
Scope: DIDescriptor,
File: DIFile,
Line: c_uint,
- Col: c_uint)
+ Col: c_uint,
+ Discriminator: c_uint)
-> DILexicalBlock;
pub fn LLVMDIBuilderCreateStaticVariable(Builder: DIBuilderRef,
}
// Add the no-split-stack attribute if requested
- if contains_name(attrs, "no_split_stack") {
- set_no_split_stack(llfn);
+ if !contains_name(attrs, "no_split_stack") {
+ set_split_stack(llfn);
}
if contains_name(attrs, "cold") {
lib::llvm::SetFunctionAttribute(f, lib::llvm::AlwaysInlineAttribute)
}
-pub fn set_no_split_stack(f: ValueRef) {
- "no-split-stack".with_c_str(|buf| {
+pub fn set_split_stack(f: ValueRef) {
+ "split-stack".with_c_str(|buf| {
unsafe { llvm::LLVMAddFunctionAttrString(f, buf); }
})
}
// Atomic Operations
pub fn AtomicCmpXchg(cx: &Block, dst: ValueRef,
cmp: ValueRef, src: ValueRef,
- order: AtomicOrdering) -> ValueRef {
- B(cx).atomic_cmpxchg(dst, cmp, src, order)
+ order: AtomicOrdering,
+ failure_order: AtomicOrdering) -> ValueRef {
+ B(cx).atomic_cmpxchg(dst, cmp, src, order, failure_order)
}
pub fn AtomicRMW(cx: &Block, op: AtomicBinOp,
dst: ValueRef, src: ValueRef,
// Atomic Operations
pub fn atomic_cmpxchg(&self, dst: ValueRef,
cmp: ValueRef, src: ValueRef,
- order: AtomicOrdering) -> ValueRef {
+ order: AtomicOrdering,
+ failure_order: AtomicOrdering) -> ValueRef {
unsafe {
- llvm::LLVMBuildAtomicCmpXchg(self.llbuilder, dst, cmp, src, order)
+ llvm::LLVMBuildAtomicCmpXchg(self.llbuilder, dst, cmp, src,
+ order, failure_order)
}
}
pub fn atomic_rmw(&self, op: AtomicBinOp,
parent_scope,
file_metadata,
loc.line as c_uint,
- loc.col.to_uint() as c_uint)
+ loc.col.to_uint() as c_uint,
+ 0)
};
scope_stack.push(ScopeStackEntry { scope_metadata: scope_metadata, ident: None });
parent_scope,
file_metadata,
loc.line as c_uint,
- loc.col.to_uint() as c_uint)
+ loc.col.to_uint() as c_uint,
+ 0)
};
scope_stack.push(ScopeStackEntry {
match *split.get(1) {
"cxchg" => {
+ // See include/llvm/IR/Instructions.h for their implementation
+ // of this, I assume that it's good enough for us to use for
+ // now.
+ let strongest_failure_ordering = match order {
+ lib::llvm::NotAtomic | lib::llvm::Unordered =>
+ ccx.sess().fatal("cmpxchg must be atomic"),
+ lib::llvm::Monotonic | lib::llvm::Release =>
+ lib::llvm::Monotonic,
+ lib::llvm::Acquire | lib::llvm::AcquireRelease =>
+ lib::llvm::Acquire,
+ lib::llvm::SequentiallyConsistent =>
+ lib::llvm::SequentiallyConsistent,
+ };
let old = AtomicCmpXchg(bcx, get_param(decl, first_real_arg),
get_param(decl, first_real_arg + 1u),
get_param(decl, first_real_arg + 2u),
- order);
+ order, strongest_failure_ordering);
Ret(bcx, old);
}
"load" => {
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-
-use back::link::mangle_exported_name;
+use back::link::exported_name;
use driver::session;
use lib::llvm::ValueRef;
use middle::trans::base::{set_llvm_fn_attrs, set_inline_hint};
use syntax::ast;
use syntax::ast_map;
use syntax::ast_util::local_def;
+use std::hash::sip;
pub fn monomorphic_fn(ccx: &CrateContext,
fn_id: ast::DefId,
}
let s = ccx.tcx.map.with_path(fn_id.node, |path| {
- mangle_exported_name(ccx, path, mono_ty, fn_id.node)
+ exported_name(path, format!("h{}", sip::hash(&(hash_id, mono_ty))),
+ ccx.link_meta.crateid.version_or_default())
});
debug!("monomorphize_fn mangled to {}", s);
-Subproject commit 263c617d66005999afa27d00809c1568a26112ee
+Subproject commit 4b4d0533b4f76cc3fbba31bd9e7ac02e0c738b1d
TargetOptions Options;
Options.NoFramePointerElim = NoFramePointerElim;
+#if LLVM_VERSION_MINOR < 5
Options.EnableSegmentedStacks = EnableSegmentedStacks;
+#endif
Options.FloatABIType = FloatABI::Default;
Options.UseSoftFloat = UseSoftFloat;
if (UseSoftFloat) {
LLVMPassManagerRef PMR,
LLVMModuleRef M) {
PassManagerBase *PM = unwrap(PMR);
+#if LLVM_VERSION_MINOR >= 5
+ PM->add(new DataLayoutPass(unwrap(M)));
+#else
PM->add(new DataLayout(unwrap(M)));
+#endif
unwrap(TM)->addAnalysisPasses(*PM);
}
LLVMValueRef target,
LLVMValueRef old,
LLVMValueRef source,
- AtomicOrdering order) {
+ AtomicOrdering order,
+ AtomicOrdering failure_order) {
return wrap(unwrap(B)->CreateAtomicCmpXchg(unwrap(target), unwrap(old),
- unwrap(source), order));
+ unwrap(source), order
+#if LLVM_VERSION_MINOR >= 5
+ , failure_order
+#endif
+ ));
}
extern "C" LLVMValueRef LLVMBuildAtomicFence(LLVMBuilderRef B, AtomicOrdering order) {
return wrap(unwrap(B)->CreateFence(order));
RunTimeLang,
unwrapDI<DIType>(VTableHolder)
#if LLVM_VERSION_MINOR >= 5
- ,UniqueId));
-#else
- ));
+ ,UniqueId
#endif
+ ));
}
extern "C" LLVMValueRef LLVMDIBuilderCreateMemberType(
LLVMValueRef Scope,
LLVMValueRef File,
unsigned Line,
- unsigned Col) {
+ unsigned Col,
+ unsigned Discriminator) {
return wrap(Builder->createLexicalBlock(
unwrapDI<DIDescriptor>(Scope),
- unwrapDI<DIFile>(File), Line, Col));
+ unwrapDI<DIFile>(File), Line, Col
+#if LLVM_VERSION_MINOR >= 5
+ , Discriminator
+#endif
+ ));
}
extern "C" LLVMValueRef LLVMDIBuilderCreateStaticVariable(
unwrapDI<DIArray>(Elements),
RunTimeLang
#if LLVM_VERSION_MINOR >= 5
- ,UniqueId));
-#else
- ));
+ ,UniqueId
#endif
+ ));
}
+#if LLVM_VERSION_MINOR < 5
extern "C" void LLVMSetUnnamedAddr(LLVMValueRef Value, LLVMBool Unnamed) {
unwrap<GlobalValue>(Value)->setUnnamedAddr(Unnamed);
}
+#endif
extern "C" LLVMValueRef LLVMDIBuilderCreateTemplateTypeParameter(
DIBuilderRef Builder,
}
#endif
+#if LLVM_VERSION_MINOR >= 5
+extern "C" void*
+LLVMRustOpenArchive(char *path) {
+ std::unique_ptr<MemoryBuffer> buf;
+ error_code err = MemoryBuffer::getFile(path, buf);
+ if (err) {
+ LLVMRustError = err.message().c_str();
+ return NULL;
+ }
+ Archive *ret = new Archive(buf.release(), err);
+ if (err) {
+ LLVMRustError = err.message().c_str();
+ return NULL;
+ }
+ return ret;
+}
+#else
extern "C" void*
LLVMRustOpenArchive(char *path) {
OwningPtr<MemoryBuffer> buf;
}
return ret;
}
+#endif
extern "C" const char*
LLVMRustArchiveReadSection(Archive *ar, char *name, size_t *size) {
# If this file is modified, then llvm will be forcibly cleaned and then rebuilt.
# The actual contents of this file do not matter, but to trigger a change on the
# build bots then the contents should be changed so git updates the mtime.
-2014-02-25
+2014-04-14
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
-#include "llvm/Linker.h"
#include "llvm/PassManager.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/Transforms/IPO.h"
#include "llvm/Transforms/Instrumentation.h"
#include "llvm/Transforms/Vectorize.h"
-#include "llvm/DebugInfo.h"
-#include "llvm/DIBuilder.h"
#include "llvm/Bitcode/ReaderWriter.h"
#include "llvm-c/Core.h"
#include "llvm-c/BitReader.h"
#if LLVM_VERSION_MINOR >= 5
#include "llvm/IR/IRPrintingPasses.h"
+#include "llvm/IR/DebugInfo.h"
+#include "llvm/IR/DIBuilder.h"
+#include "llvm/Linker/Linker.h"
#else
#include "llvm/Assembly/PrintModulePass.h"
+#include "llvm/DebugInfo.h"
+#include "llvm/DIBuilder.h"
+#include "llvm/Linker.h"
#endif
// Used by RustMCJITMemoryManager::getPointerToNamedFunction()