auto merge of #7115 : alexcrichton/rust/llvm-upgrades, r=thestinger
This is a reopening of #6713 This is still blocked on windows failures. I'll re-push try once the existing crisis has passed.
This commit is contained in:
commit
3d14470be4
10 changed files with 72 additions and 80 deletions
2
.gitmodules
vendored
2
.gitmodules
vendored
|
@ -1,6 +1,6 @@
|
||||||
[submodule "src/llvm"]
|
[submodule "src/llvm"]
|
||||||
path = src/llvm
|
path = src/llvm
|
||||||
url = https://github.com/brson/llvm.git
|
url = https://github.com/alexcrichton/llvm.git
|
||||||
branch = master
|
branch = master
|
||||||
[submodule "src/libuv"]
|
[submodule "src/libuv"]
|
||||||
path = src/libuv
|
path = src/libuv
|
||||||
|
|
|
@ -14,7 +14,9 @@ LLVM_DEPS := $(S)/.gitmodules
|
||||||
else
|
else
|
||||||
|
|
||||||
# This is just a rough approximation of LLVM deps
|
# This is just a rough approximation of LLVM deps
|
||||||
LLVM_DEPS=$(call rwildcard,$(CFG_LLVM_SRC_DIR),*cpp *hpp)
|
LLVM_DEPS_SRC=$(call rwildcard,$(CFG_LLVM_SRC_DIR)/lib,*cpp *hpp)
|
||||||
|
LLVM_DEPS_INC=$(call rwildcard,$(CFG_LLVM_SRC_DIR)/include,*cpp *hpp)
|
||||||
|
LLVM_DEPS=$(LLVM_DEPS_SRC) $(LLVM_DEPS_INC)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
define DEF_LLVM_RULES
|
define DEF_LLVM_RULES
|
||||||
|
|
|
@ -97,7 +97,6 @@ pub fn create_standard_passes(level: OptLevel) -> ~[~str] {
|
||||||
passes.push(~"sroa");
|
passes.push(~"sroa");
|
||||||
passes.push(~"domtree");
|
passes.push(~"domtree");
|
||||||
passes.push(~"early-cse");
|
passes.push(~"early-cse");
|
||||||
passes.push(~"simplify-libcalls");
|
|
||||||
passes.push(~"lazy-value-info");
|
passes.push(~"lazy-value-info");
|
||||||
passes.push(~"jump-threading");
|
passes.push(~"jump-threading");
|
||||||
passes.push(~"correlated-propagation");
|
passes.push(~"correlated-propagation");
|
||||||
|
|
|
@ -59,35 +59,37 @@ pub enum Linkage {
|
||||||
|
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub enum Attribute {
|
pub enum Attribute {
|
||||||
ZExtAttribute = 1,
|
ZExtAttribute = 1 << 0,
|
||||||
SExtAttribute = 2,
|
SExtAttribute = 1 << 1,
|
||||||
NoReturnAttribute = 4,
|
NoReturnAttribute = 1 << 2,
|
||||||
InRegAttribute = 8,
|
InRegAttribute = 1 << 3,
|
||||||
StructRetAttribute = 16,
|
StructRetAttribute = 1 << 4,
|
||||||
NoUnwindAttribute = 32,
|
NoUnwindAttribute = 1 << 5,
|
||||||
NoAliasAttribute = 64,
|
NoAliasAttribute = 1 << 6,
|
||||||
ByValAttribute = 128,
|
ByValAttribute = 1 << 7,
|
||||||
NestAttribute = 256,
|
NestAttribute = 1 << 8,
|
||||||
ReadNoneAttribute = 512,
|
ReadNoneAttribute = 1 << 9,
|
||||||
ReadOnlyAttribute = 1024,
|
ReadOnlyAttribute = 1 << 10,
|
||||||
NoInlineAttribute = 2048,
|
NoInlineAttribute = 1 << 11,
|
||||||
AlwaysInlineAttribute = 4096,
|
AlwaysInlineAttribute = 1 << 12,
|
||||||
OptimizeForSizeAttribute = 8192,
|
OptimizeForSizeAttribute = 1 << 13,
|
||||||
StackProtectAttribute = 16384,
|
StackProtectAttribute = 1 << 14,
|
||||||
StackProtectReqAttribute = 32768,
|
StackProtectReqAttribute = 1 << 15,
|
||||||
// 31 << 16
|
AlignmentAttribute = 31 << 16,
|
||||||
AlignmentAttribute = 2031616,
|
NoCaptureAttribute = 1 << 21,
|
||||||
NoCaptureAttribute = 2097152,
|
NoRedZoneAttribute = 1 << 22,
|
||||||
NoRedZoneAttribute = 4194304,
|
NoImplicitFloatAttribute = 1 << 23,
|
||||||
NoImplicitFloatAttribute = 8388608,
|
NakedAttribute = 1 << 24,
|
||||||
NakedAttribute = 16777216,
|
InlineHintAttribute = 1 << 25,
|
||||||
InlineHintAttribute = 33554432,
|
StackAttribute = 7 << 26,
|
||||||
// 7 << 26
|
ReturnsTwiceAttribute = 1 << 29,
|
||||||
StackAttribute = 469762048,
|
UWTableAttribute = 1 << 30,
|
||||||
ReturnsTwiceAttribute = 536870912,
|
NonLazyBindAttribute = 1 << 31,
|
||||||
// 1 << 30
|
|
||||||
UWTableAttribute = 1073741824,
|
// Not added to LLVM yet, so may need to stay updated if LLVM changes.
|
||||||
NonLazyBindAttribute = 2147483648,
|
// FIXME(#8199): if this changes, be sure to change the relevant constant
|
||||||
|
// down below
|
||||||
|
// FixedStackSegment = 1 << 41,
|
||||||
}
|
}
|
||||||
|
|
||||||
// enum for the LLVM IntPredicate type
|
// enum for the LLVM IntPredicate type
|
||||||
|
@ -1541,7 +1543,8 @@ pub mod llvm {
|
||||||
Op: AtomicBinOp,
|
Op: AtomicBinOp,
|
||||||
LHS: ValueRef,
|
LHS: ValueRef,
|
||||||
RHS: ValueRef,
|
RHS: ValueRef,
|
||||||
Order: AtomicOrdering)
|
Order: AtomicOrdering,
|
||||||
|
SingleThreaded: Bool)
|
||||||
-> ValueRef;
|
-> ValueRef;
|
||||||
|
|
||||||
pub fn LLVMBuildAtomicFence(B: BuilderRef, Order: AtomicOrdering);
|
pub fn LLVMBuildAtomicFence(B: BuilderRef, Order: AtomicOrdering);
|
||||||
|
@ -2106,6 +2109,28 @@ pub fn ConstFCmp(Pred: RealPredicate, V1: ValueRef, V2: ValueRef) -> ValueRef {
|
||||||
llvm::LLVMConstFCmp(Pred as c_ushort, V1, V2)
|
llvm::LLVMConstFCmp(Pred as c_ushort, V1, V2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn SetFunctionAttribute(Fn: ValueRef, attr: Attribute) {
|
||||||
|
unsafe {
|
||||||
|
let attr = attr as u64;
|
||||||
|
let lower = attr & 0xffffffff;
|
||||||
|
let upper = (attr >> 32) & 0xffffffff;
|
||||||
|
llvm::LLVMAddFunctionAttr(Fn, lower as c_uint, upper as c_uint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME(#8199): this shouldn't require this hackery. On i686
|
||||||
|
// (FixedStackSegment as u64) will return 0 instead of 1 << 41.
|
||||||
|
// Furthermore, if we use a match of any sort then an LLVM
|
||||||
|
// assertion is generated!
|
||||||
|
pub fn SetFixedStackSegmentAttribute(Fn: ValueRef) {
|
||||||
|
unsafe {
|
||||||
|
let attr = 1u64 << 41;
|
||||||
|
let lower = attr & 0xffffffff;
|
||||||
|
let upper = (attr >> 32) & 0xffffffff;
|
||||||
|
llvm::LLVMAddFunctionAttr(Fn, lower as c_uint, upper as c_uint);
|
||||||
|
}
|
||||||
|
}
|
||||||
/* Memory-managed object interface to type handles. */
|
/* Memory-managed object interface to type handles. */
|
||||||
|
|
||||||
pub struct TypeNames {
|
pub struct TypeNames {
|
||||||
|
|
|
@ -419,46 +419,25 @@ pub fn get_tydesc(ccx: &mut CrateContext, t: ty::t) -> @mut tydesc_info {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_optimize_for_size(f: ValueRef) {
|
pub fn set_optimize_for_size(f: ValueRef) {
|
||||||
unsafe {
|
lib::llvm::SetFunctionAttribute(f, lib::llvm::OptimizeForSizeAttribute)
|
||||||
llvm::LLVMAddFunctionAttr(f,
|
|
||||||
lib::llvm::OptimizeForSizeAttribute
|
|
||||||
as c_uint,
|
|
||||||
0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_no_inline(f: ValueRef) {
|
pub fn set_no_inline(f: ValueRef) {
|
||||||
unsafe {
|
lib::llvm::SetFunctionAttribute(f, lib::llvm::NoInlineAttribute)
|
||||||
llvm::LLVMAddFunctionAttr(f,
|
|
||||||
lib::llvm::NoInlineAttribute as c_uint,
|
|
||||||
0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_no_unwind(f: ValueRef) {
|
pub fn set_no_unwind(f: ValueRef) {
|
||||||
unsafe {
|
lib::llvm::SetFunctionAttribute(f, lib::llvm::NoUnwindAttribute)
|
||||||
llvm::LLVMAddFunctionAttr(f,
|
|
||||||
lib::llvm::NoUnwindAttribute as c_uint,
|
|
||||||
0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tell LLVM to emit the information necessary to unwind the stack for the
|
// Tell LLVM to emit the information necessary to unwind the stack for the
|
||||||
// function f.
|
// function f.
|
||||||
pub fn set_uwtable(f: ValueRef) {
|
pub fn set_uwtable(f: ValueRef) {
|
||||||
unsafe {
|
lib::llvm::SetFunctionAttribute(f, lib::llvm::UWTableAttribute)
|
||||||
llvm::LLVMAddFunctionAttr(f,
|
|
||||||
lib::llvm::UWTableAttribute as c_uint,
|
|
||||||
0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_inline_hint(f: ValueRef) {
|
pub fn set_inline_hint(f: ValueRef) {
|
||||||
unsafe {
|
lib::llvm::SetFunctionAttribute(f, lib::llvm::InlineHintAttribute)
|
||||||
llvm::LLVMAddFunctionAttr(f,
|
|
||||||
lib::llvm::InlineHintAttribute as c_uint,
|
|
||||||
0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_inline_hint_if_appr(attrs: &[ast::Attribute],
|
pub fn set_inline_hint_if_appr(attrs: &[ast::Attribute],
|
||||||
|
@ -473,17 +452,11 @@ pub fn set_inline_hint_if_appr(attrs: &[ast::Attribute],
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_always_inline(f: ValueRef) {
|
pub fn set_always_inline(f: ValueRef) {
|
||||||
unsafe {
|
lib::llvm::SetFunctionAttribute(f, lib::llvm::AlwaysInlineAttribute)
|
||||||
llvm::LLVMAddFunctionAttr(f,
|
|
||||||
lib::llvm::AlwaysInlineAttribute as c_uint,
|
|
||||||
0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_fixed_stack_segment(f: ValueRef) {
|
pub fn set_fixed_stack_segment(f: ValueRef) {
|
||||||
unsafe {
|
lib::llvm::SetFixedStackSegmentAttribute(f);
|
||||||
llvm::LLVMAddFunctionAttr(f, 0, 1 << (39 - 32));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_glue_inlining(f: ValueRef, t: ty::t) {
|
pub fn set_glue_inlining(f: ValueRef, t: ty::t) {
|
||||||
|
|
|
@ -940,7 +940,7 @@ impl Builder {
|
||||||
dst: ValueRef, src: ValueRef,
|
dst: ValueRef, src: ValueRef,
|
||||||
order: AtomicOrdering) -> ValueRef {
|
order: AtomicOrdering) -> ValueRef {
|
||||||
unsafe {
|
unsafe {
|
||||||
llvm::LLVMBuildAtomicRMW(self.llbuilder, op, dst, src, order)
|
llvm::LLVMBuildAtomicRMW(self.llbuilder, op, dst, src, order, False)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
src/llvm
2
src/llvm
|
@ -1 +1 @@
|
||||||
Subproject commit 2e9f0d21fe321849a4759a01fc28eae82ef196d6
|
Subproject commit f67442eee27d3d075a65cf7f9a70f7ec6649ffd1
|
|
@ -113,6 +113,7 @@ public:
|
||||||
|
|
||||||
virtual uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
|
virtual uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
|
||||||
unsigned SectionID, bool isReadOnly);
|
unsigned SectionID, bool isReadOnly);
|
||||||
|
bool finalizeMemory(std::string *ErrMsg) { return false; }
|
||||||
|
|
||||||
virtual bool applyPermissions(std::string *Str);
|
virtual bool applyPermissions(std::string *Str);
|
||||||
|
|
||||||
|
@ -340,7 +341,6 @@ LLVMRustBuildJIT(void* mem,
|
||||||
|
|
||||||
std::string Err;
|
std::string Err;
|
||||||
TargetOptions Options;
|
TargetOptions Options;
|
||||||
Options.JITExceptionHandling = true;
|
|
||||||
Options.JITEmitDebugInfo = true;
|
Options.JITEmitDebugInfo = true;
|
||||||
Options.NoFramePointerElim = true;
|
Options.NoFramePointerElim = true;
|
||||||
Options.EnableSegmentedStacks = EnableSegmentedStacks;
|
Options.EnableSegmentedStacks = EnableSegmentedStacks;
|
||||||
|
@ -516,15 +516,6 @@ extern "C" LLVMValueRef LLVMBuildAtomicCmpXchg(LLVMBuilderRef B,
|
||||||
extern "C" LLVMValueRef LLVMBuildAtomicFence(LLVMBuilderRef B, AtomicOrdering order) {
|
extern "C" LLVMValueRef LLVMBuildAtomicFence(LLVMBuilderRef B, AtomicOrdering order) {
|
||||||
return wrap(unwrap(B)->CreateFence(order));
|
return wrap(unwrap(B)->CreateFence(order));
|
||||||
}
|
}
|
||||||
extern "C" LLVMValueRef LLVMBuildAtomicRMW(LLVMBuilderRef B,
|
|
||||||
AtomicRMWInst::BinOp op,
|
|
||||||
LLVMValueRef target,
|
|
||||||
LLVMValueRef source,
|
|
||||||
AtomicOrdering order) {
|
|
||||||
return wrap(unwrap(B)->CreateAtomicRMW(op,
|
|
||||||
unwrap(target), unwrap(source),
|
|
||||||
order));
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" void LLVMSetDebug(int Enabled) {
|
extern "C" void LLVMSetDebug(int Enabled) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# If this file is modified, then llvm will be forcibly cleaned and then rebuilt.
|
# 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
|
# 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.
|
# build bots then the contents should be changed so git updates the mtime.
|
||||||
2013-07-03
|
2013-07-04
|
||||||
|
|
|
@ -8,8 +8,10 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
#include "llvm/IR/IRBuilder.h"
|
||||||
#include "llvm/IR/InlineAsm.h"
|
#include "llvm/IR/InlineAsm.h"
|
||||||
#include "llvm/IR/LLVMContext.h"
|
#include "llvm/IR/LLVMContext.h"
|
||||||
|
#include "llvm/IR/Module.h"
|
||||||
#include "llvm/Linker.h"
|
#include "llvm/Linker.h"
|
||||||
#include "llvm/PassManager.h"
|
#include "llvm/PassManager.h"
|
||||||
#include "llvm/IR/InlineAsm.h"
|
#include "llvm/IR/InlineAsm.h"
|
||||||
|
|
Loading…
Reference in a new issue