Skip to content

Update LLVM to rust-llvm-2015-01-30 #21785

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 10 additions & 14 deletions src/librustc_llvm/lib.rs
Original file line number Diff line number Diff line change
@@ -1843,7 +1843,7 @@ extern {
Decl: ValueRef)
-> DIGlobalVariable;

pub fn LLVMDIBuilderCreateLocalVariable(Builder: DIBuilderRef,
pub fn LLVMDIBuilderCreateVariable(Builder: DIBuilderRef,
Tag: c_uint,
Scope: DIDescriptor,
Name: *const c_char,
@@ -1852,6 +1852,8 @@ extern {
Ty: DIType,
AlwaysPreserve: bool,
Flags: c_uint,
AddrOps: *const ValueRef,
AddrOpsCount: c_uint,
ArgNo: c_uint)
-> DIVariable;

@@ -1882,12 +1884,16 @@ extern {
pub fn LLVMDIBuilderInsertDeclareAtEnd(Builder: DIBuilderRef,
Val: ValueRef,
VarInfo: DIVariable,
AddrOps: *const ValueRef,
AddrOpsCount: c_uint,
InsertAtEnd: BasicBlockRef)
-> ValueRef;

pub fn LLVMDIBuilderInsertDeclareBefore(Builder: DIBuilderRef,
Val: ValueRef,
VarInfo: DIVariable,
AddrOps: *const ValueRef,
AddrOpsCount: c_uint,
InsertBefore: ValueRef)
-> ValueRef;

@@ -1935,26 +1941,16 @@ extern {

pub fn LLVMDIBuilderCreateOpPlus(IntType: TypeRef) -> ValueRef;

pub fn LLVMDIBuilderCreateComplexVariable(Builder: DIBuilderRef,
Tag: c_uint,
Scope: ValueRef,
Name: *const c_char,
File: ValueRef,
LineNo: c_uint,
Ty: ValueRef,
AddrOps: *const ValueRef,
AddrOpsCount: c_uint,
ArgNo: c_uint)
-> ValueRef;

pub fn LLVMDIBuilderCreateNameSpace(Builder: DIBuilderRef,
Scope: ValueRef,
Name: *const c_char,
File: ValueRef,
LineNo: c_uint)
-> ValueRef;

pub fn LLVMDICompositeTypeSetTypeArray(CompositeType: ValueRef, TypeArray: ValueRef);
pub fn LLVMDICompositeTypeSetTypeArray(Builder: DIBuilderRef,
CompositeType: ValueRef,
TypeArray: ValueRef);
pub fn LLVMWriteTypeToString(Type: TypeRef, s: RustStringRef);
pub fn LLVMWriteValueToString(value_ref: ValueRef, s: RustStringRef);

4 changes: 3 additions & 1 deletion src/librustc_trans/trans/base.rs
Original file line number Diff line number Diff line change
@@ -2007,7 +2007,9 @@ pub fn trans_named_tuple_constructor<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
let bcx = match dest {
expr::SaveIn(_) => bcx,
expr::Ignore => {
glue::drop_ty(bcx, llresult, result_ty, debug_loc)
let bcx = glue::drop_ty(bcx, llresult, result_ty, debug_loc);
call_lifetime_end(bcx, llresult);
bcx
}
};

4 changes: 4 additions & 0 deletions src/librustc_trans/trans/datum.rs
Original file line number Diff line number Diff line change
@@ -199,6 +199,9 @@ impl KindOps for Rvalue {
-> Block<'blk, 'tcx> {
// No cleanup is scheduled for an rvalue, so we don't have
// to do anything after a move to cancel or duplicate it.
if self.is_by_ref() {
call_lifetime_end(bcx, _val);
}
bcx
}

@@ -320,6 +323,7 @@ impl<'tcx> Datum<'tcx, Rvalue> {
ByValue => DatumBlock::new(bcx, self),
ByRef => {
let llval = load_ty(bcx, self.val, self.ty);
call_lifetime_end(bcx, self.val);
DatumBlock::new(bcx, Datum::new(llval, self.ty, Rvalue::new(ByValue)))
}
}
51 changes: 19 additions & 32 deletions src/librustc_trans/trans/debuginfo.rs
Original file line number Diff line number Diff line change
@@ -1699,11 +1699,11 @@ fn declare_local<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
};

let name = CString::from_slice(name.get().as_bytes());
let (var_alloca, var_metadata) = match variable_access {
DirectVariable { alloca } => (
alloca,
unsafe {
llvm::LLVMDIBuilderCreateLocalVariable(
match (variable_access, [].as_slice()) {
(DirectVariable { alloca }, address_operations) |
(IndirectVariable {alloca, address_operations}, _) => {
let metadata = unsafe {
llvm::LLVMDIBuilderCreateVariable(
DIB(cx),
dwarf_tag,
scope_metadata,
@@ -1713,38 +1713,25 @@ fn declare_local<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
type_metadata,
cx.sess().opts.optimize != config::No,
0,
argument_index)
}
),
IndirectVariable { alloca, address_operations } => (
alloca,
unsafe {
llvm::LLVMDIBuilderCreateComplexVariable(
DIB(cx),
dwarf_tag,
scope_metadata,
name.as_ptr(),
file_metadata,
loc.line as c_uint,
type_metadata,
address_operations.as_ptr(),
address_operations.len() as c_uint,
argument_index)
}
)
};

set_debug_location(cx, InternalDebugLocation::new(scope_metadata,
};
set_debug_location(cx, InternalDebugLocation::new(scope_metadata,
loc.line,
loc.col.to_usize()));
unsafe {
let instr = llvm::LLVMDIBuilderInsertDeclareAtEnd(
DIB(cx),
var_alloca,
var_metadata,
bcx.llbb);
unsafe {
let instr = llvm::LLVMDIBuilderInsertDeclareAtEnd(
DIB(cx),
alloca,
metadata,
address_operations.as_ptr(),
address_operations.len() as c_uint,
bcx.llbb);

llvm::LLVMSetInstDebugLocation(trans::build::B(bcx).llbuilder, instr);
llvm::LLVMSetInstDebugLocation(trans::build::B(bcx).llbuilder, instr);
}
}
}

match variable_kind {
@@ -2716,7 +2703,7 @@ fn set_members_of_composite_type(cx: &CrateContext,

unsafe {
let type_array = create_DIArray(DIB(cx), &member_metadata[]);
llvm::LLVMDICompositeTypeSetTypeArray(composite_type_metadata, type_array);
llvm::LLVMDICompositeTypeSetTypeArray(DIB(cx), composite_type_metadata, type_array);
}
}

9 changes: 7 additions & 2 deletions src/librustc_trans/trans/intrinsic.rs
Original file line number Diff line number Diff line change
@@ -243,7 +243,8 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
dest
};

fcx.pop_custom_cleanup_scope(cleanup_scope);
fcx.scopes.borrow_mut().last_mut().unwrap().drop_non_lifetime_clean();
fcx.pop_and_trans_custom_cleanup_scope(bcx, cleanup_scope);

return match dest {
expr::SaveIn(d) => Result::new(bcx, d),
@@ -268,17 +269,19 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
false,
RustIntrinsic);

fcx.pop_custom_cleanup_scope(cleanup_scope);
fcx.scopes.borrow_mut().last_mut().unwrap().drop_non_lifetime_clean();

let call_debug_location = DebugLoc::At(call_info.id, call_info.span);

// These are the only intrinsic functions that diverge.
if name.get() == "abort" {
let llfn = ccx.get_intrinsic(&("llvm.trap"));
Call(bcx, llfn, &[], None, call_debug_location);
fcx.pop_and_trans_custom_cleanup_scope(bcx, cleanup_scope);
Unreachable(bcx);
return Result::new(bcx, C_undef(Type::nil(ccx).ptr_to()));
} else if name.get() == "unreachable" {
fcx.pop_and_trans_custom_cleanup_scope(bcx, cleanup_scope);
Unreachable(bcx);
return Result::new(bcx, C_nil(ccx));
}
@@ -765,6 +768,8 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
expr::SaveIn(_) => {}
}

fcx.pop_and_trans_custom_cleanup_scope(bcx, cleanup_scope);

Result::new(bcx, llresult)
}

2 changes: 1 addition & 1 deletion src/llvm
Submodule llvm updated 4187 files
2 changes: 1 addition & 1 deletion src/rustllvm/ExecutionEngineWrapper.cpp
Original file line number Diff line number Diff line change
@@ -94,7 +94,7 @@ extern "C" LLVMExecutionEngineRef LLVMBuildExecutionEngine(
ExecutionEngine *ee = EngineBuilder(std::move(m))
.setEngineKind(EngineKind::JIT)
.setErrorStr(&error_str)
.setMCJITMemoryManager(mm)
.setMCJITMemoryManager(std::unique_ptr<RTDyldMemoryManager>(mm))
.setTargetOptions(options)
.create();

241 changes: 142 additions & 99 deletions src/rustllvm/RustWrapper.cpp

Large diffs are not rendered by default.