Skip to content

Commit fadf82d

Browse files
committed
---
yaml --- r: 178087 b: refs/heads/auto c: 602e508 h: refs/heads/master i: 178085: 0e55f9e 178083: 63af6f5 178079: ede6ae2 v: v3
1 parent 68713a5 commit fadf82d

File tree

8 files changed

+269
-204
lines changed

8 files changed

+269
-204
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: 682f867bbfff97e3aef55bdf228d279e45f25cd9
13+
refs/heads/auto: 602e508db0fd3566ef59a6a4833b68c3a55ddc79
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/librustc_llvm/lib.rs

Lines changed: 53 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ use libc::{c_uint, c_ushort, uint64_t, c_int, size_t, c_char};
6464
use libc::{c_longlong, c_ulonglong, c_void};
6565
use debuginfo::{DIBuilderRef, DIDescriptor,
6666
DIFile, DILexicalBlock, DISubprogram, DIType,
67-
DIBasicType, DIDerivedType, DICompositeType,
68-
DIVariable, DIGlobalVariable, DIArray, DISubrange};
67+
DIBasicType, DIDerivedType, DICompositeType, DIScope,
68+
DIVariable, DIGlobalVariable, DIArray, DISubrange,
69+
DITemplateTypeParameter, DIEnumerator, DINameSpace};
6970

7071
pub mod archive_ro;
7172
pub mod diagnostic;
@@ -443,6 +444,9 @@ pub type TypeRef = *mut Type_opaque;
443444
pub enum Value_opaque {}
444445
pub type ValueRef = *mut Value_opaque;
445446
#[allow(missing_copy_implementations)]
447+
pub enum Metadata_opaque {}
448+
pub type MetadataRef = *mut Metadata_opaque;
449+
#[allow(missing_copy_implementations)]
446450
pub enum BasicBlock_opaque {}
447451
pub type BasicBlockRef = *mut BasicBlock_opaque;
448452
#[allow(missing_copy_implementations)]
@@ -502,18 +506,19 @@ pub type InlineAsmDiagHandler = unsafe extern "C" fn(SMDiagnosticRef, *const c_v
502506

503507
pub mod debuginfo {
504508
pub use self::DIDescriptorFlags::*;
505-
use super::{ValueRef};
509+
use super::{MetadataRef};
506510

507511
#[allow(missing_copy_implementations)]
508512
pub enum DIBuilder_opaque {}
509513
pub type DIBuilderRef = *mut DIBuilder_opaque;
510514

511-
pub type DIDescriptor = ValueRef;
515+
pub type DIDescriptor = MetadataRef;
512516
pub type DIScope = DIDescriptor;
513517
pub type DILocation = DIDescriptor;
514518
pub type DIFile = DIScope;
515519
pub type DILexicalBlock = DIScope;
516520
pub type DISubprogram = DIScope;
521+
pub type DINameSpace = DIScope;
517522
pub type DIType = DIDescriptor;
518523
pub type DIBasicType = DIType;
519524
pub type DIDerivedType = DIType;
@@ -522,6 +527,8 @@ pub mod debuginfo {
522527
pub type DIGlobalVariable = DIDescriptor;
523528
pub type DIArray = DIDescriptor;
524529
pub type DISubrange = DIDescriptor;
530+
pub type DIEnumerator = DIDescriptor;
531+
pub type DITemplateTypeParameter = DIDescriptor;
525532

526533
#[derive(Copy)]
527534
pub enum DIDescriptorFlags {
@@ -1779,8 +1786,8 @@ extern {
17791786
Flags: c_uint,
17801787
isOptimized: bool,
17811788
Fn: ValueRef,
1782-
TParam: ValueRef,
1783-
Decl: ValueRef)
1789+
TParam: DIArray,
1790+
Decl: DIDescriptor)
17841791
-> DISubprogram;
17851792

17861793
pub fn LLVMDIBuilderCreateBasicType(Builder: DIBuilderRef,
@@ -1808,7 +1815,7 @@ extern {
18081815
DerivedFrom: DIType,
18091816
Elements: DIArray,
18101817
RunTimeLang: c_uint,
1811-
VTableHolder: ValueRef,
1818+
VTableHolder: DIType,
18121819
UniqueId: *const c_char)
18131820
-> DICompositeType;
18141821

@@ -1825,25 +1832,25 @@ extern {
18251832
-> DIDerivedType;
18261833

18271834
pub fn LLVMDIBuilderCreateLexicalBlock(Builder: DIBuilderRef,
1828-
Scope: DIDescriptor,
1835+
Scope: DIScope,
18291836
File: DIFile,
18301837
Line: c_uint,
18311838
Col: c_uint)
18321839
-> DILexicalBlock;
18331840

18341841
pub fn LLVMDIBuilderCreateStaticVariable(Builder: DIBuilderRef,
1835-
Context: DIDescriptor,
1842+
Context: DIScope,
18361843
Name: *const c_char,
18371844
LinkageName: *const c_char,
18381845
File: DIFile,
18391846
LineNo: c_uint,
18401847
Ty: DIType,
18411848
isLocalToUnit: bool,
18421849
Val: ValueRef,
1843-
Decl: ValueRef)
1850+
Decl: DIDescriptor)
18441851
-> DIGlobalVariable;
18451852

1846-
pub fn LLVMDIBuilderCreateLocalVariable(Builder: DIBuilderRef,
1853+
pub fn LLVMDIBuilderCreateVariable(Builder: DIBuilderRef,
18471854
Tag: c_uint,
18481855
Scope: DIDescriptor,
18491856
Name: *const c_char,
@@ -1852,6 +1859,8 @@ extern {
18521859
Ty: DIType,
18531860
AlwaysPreserve: bool,
18541861
Flags: c_uint,
1862+
AddrOps: *const i64,
1863+
AddrOpsCount: c_uint,
18551864
ArgNo: c_uint)
18561865
-> DIVariable;
18571866

@@ -1882,79 +1891,80 @@ extern {
18821891
pub fn LLVMDIBuilderInsertDeclareAtEnd(Builder: DIBuilderRef,
18831892
Val: ValueRef,
18841893
VarInfo: DIVariable,
1894+
AddrOps: *const i64,
1895+
AddrOpsCount: c_uint,
18851896
InsertAtEnd: BasicBlockRef)
18861897
-> ValueRef;
18871898

18881899
pub fn LLVMDIBuilderInsertDeclareBefore(Builder: DIBuilderRef,
18891900
Val: ValueRef,
18901901
VarInfo: DIVariable,
1902+
AddrOps: *const i64,
1903+
AddrOpsCount: c_uint,
18911904
InsertBefore: ValueRef)
18921905
-> ValueRef;
18931906

18941907
pub fn LLVMDIBuilderCreateEnumerator(Builder: DIBuilderRef,
18951908
Name: *const c_char,
18961909
Val: c_ulonglong)
1897-
-> ValueRef;
1910+
-> DIEnumerator;
18981911

18991912
pub fn LLVMDIBuilderCreateEnumerationType(Builder: DIBuilderRef,
1900-
Scope: ValueRef,
1913+
Scope: DIScope,
19011914
Name: *const c_char,
1902-
File: ValueRef,
1915+
File: DIFile,
19031916
LineNumber: c_uint,
19041917
SizeInBits: c_ulonglong,
19051918
AlignInBits: c_ulonglong,
1906-
Elements: ValueRef,
1907-
ClassType: ValueRef)
1908-
-> ValueRef;
1919+
Elements: DIArray,
1920+
ClassType: DIType)
1921+
-> DIType;
19091922

19101923
pub fn LLVMDIBuilderCreateUnionType(Builder: DIBuilderRef,
1911-
Scope: ValueRef,
1924+
Scope: DIScope,
19121925
Name: *const c_char,
1913-
File: ValueRef,
1926+
File: DIFile,
19141927
LineNumber: c_uint,
19151928
SizeInBits: c_ulonglong,
19161929
AlignInBits: c_ulonglong,
19171930
Flags: c_uint,
1918-
Elements: ValueRef,
1931+
Elements: DIArray,
19191932
RunTimeLang: c_uint,
19201933
UniqueId: *const c_char)
1921-
-> ValueRef;
1934+
-> DIType;
19221935

19231936
pub fn LLVMSetUnnamedAddr(GlobalVar: ValueRef, UnnamedAddr: Bool);
19241937

19251938
pub fn LLVMDIBuilderCreateTemplateTypeParameter(Builder: DIBuilderRef,
1926-
Scope: ValueRef,
1939+
Scope: DIScope,
19271940
Name: *const c_char,
1928-
Ty: ValueRef,
1929-
File: ValueRef,
1941+
Ty: DIType,
1942+
File: DIFile,
19301943
LineNo: c_uint,
19311944
ColumnNo: c_uint)
1932-
-> ValueRef;
1933-
1934-
pub fn LLVMDIBuilderCreateOpDeref(IntType: TypeRef) -> ValueRef;
1945+
-> DITemplateTypeParameter;
19351946

1936-
pub fn LLVMDIBuilderCreateOpPlus(IntType: TypeRef) -> ValueRef;
1947+
pub fn LLVMDIBuilderCreateOpDeref() -> i64;
19371948

1938-
pub fn LLVMDIBuilderCreateComplexVariable(Builder: DIBuilderRef,
1939-
Tag: c_uint,
1940-
Scope: ValueRef,
1941-
Name: *const c_char,
1942-
File: ValueRef,
1943-
LineNo: c_uint,
1944-
Ty: ValueRef,
1945-
AddrOps: *const ValueRef,
1946-
AddrOpsCount: c_uint,
1947-
ArgNo: c_uint)
1948-
-> ValueRef;
1949+
pub fn LLVMDIBuilderCreateOpPlus() -> i64;
19491950

19501951
pub fn LLVMDIBuilderCreateNameSpace(Builder: DIBuilderRef,
1951-
Scope: ValueRef,
1952+
Scope: DIScope,
19521953
Name: *const c_char,
1953-
File: ValueRef,
1954+
File: DIFile,
19541955
LineNo: c_uint)
1955-
-> ValueRef;
1956+
-> DINameSpace;
1957+
1958+
pub fn LLVMDIBuilderCreateDebugLocation(Context: ContextRef,
1959+
Line: c_uint,
1960+
Column: c_uint,
1961+
Scope: DIScope,
1962+
InlinedAt: MetadataRef)
1963+
-> ValueRef;
19561964

1957-
pub fn LLVMDICompositeTypeSetTypeArray(CompositeType: ValueRef, TypeArray: ValueRef);
1965+
pub fn LLVMDICompositeTypeSetTypeArray(Builder: DIBuilderRef,
1966+
CompositeType: DIType,
1967+
TypeArray: DIArray);
19581968
pub fn LLVMWriteTypeToString(Type: TypeRef, s: RustStringRef);
19591969
pub fn LLVMWriteValueToString(value_ref: ValueRef, s: RustStringRef);
19601970

branches/auto/src/librustc_trans/trans/common.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -780,10 +780,6 @@ pub fn C_i32(ccx: &CrateContext, i: i32) -> ValueRef {
780780
C_integral(Type::i32(ccx), i as u64, true)
781781
}
782782

783-
pub fn C_i64(ccx: &CrateContext, i: i64) -> ValueRef {
784-
C_integral(Type::i64(ccx), i as u64, true)
785-
}
786-
787783
pub fn C_u64(ccx: &CrateContext, i: u64) -> ValueRef {
788784
C_integral(Type::i64(ccx), i, false)
789785
}

branches/auto/src/librustc_trans/trans/debuginfo.rs

Lines changed: 33 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ use metadata::csearch;
197197
use middle::subst::{self, Substs};
198198
use trans::{self, adt, machine, type_of};
199199
use trans::common::{self, NodeIdAndSpan, CrateContext, FunctionContext, Block,
200-
C_bytes, C_i32, C_i64, NormalizingClosureTyper};
200+
C_bytes, NormalizingClosureTyper};
201201
use trans::_match::{BindingInfo, TrByCopy, TrByMove, TrByRef};
202202
use trans::monomorphize;
203203
use trans::type_::Type;
@@ -702,7 +702,7 @@ enum VariableAccess<'a> {
702702
DirectVariable { alloca: ValueRef },
703703
// The llptr given is an alloca containing the start of some pointer chain
704704
// leading to the variable's content.
705-
IndirectVariable { alloca: ValueRef, address_operations: &'a [ValueRef] }
705+
IndirectVariable { alloca: ValueRef, address_operations: &'a [i64] }
706706
}
707707

708708
enum VariableKind {
@@ -928,10 +928,10 @@ pub fn create_captured_var_metadata<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
928928
env_index);
929929

930930
let address_operations = unsafe {
931-
[llvm::LLVMDIBuilderCreateOpDeref(Type::i64(cx).to_ref()),
932-
llvm::LLVMDIBuilderCreateOpPlus(Type::i64(cx).to_ref()),
933-
C_i64(cx, byte_offset_of_var_in_env as i64),
934-
llvm::LLVMDIBuilderCreateOpDeref(Type::i64(cx).to_ref())]
931+
[llvm::LLVMDIBuilderCreateOpDeref(),
932+
llvm::LLVMDIBuilderCreateOpPlus(),
933+
byte_offset_of_var_in_env as i64,
934+
llvm::LLVMDIBuilderCreateOpDeref()]
935935
};
936936

937937
let address_op_count = if captured_by_ref {
@@ -969,7 +969,7 @@ pub fn create_match_binding_metadata<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
969969

970970
let scope_metadata = scope_metadata(bcx.fcx, binding.id, binding.span);
971971
let aops = unsafe {
972-
[llvm::LLVMDIBuilderCreateOpDeref(bcx.ccx().int_type().to_ref())]
972+
[llvm::LLVMDIBuilderCreateOpDeref()]
973973
};
974974
// Regardless of the actual type (`T`) we're always passed the stack slot (alloca)
975975
// for the binding. For ByRef bindings that's a `T*` but for ByMove bindings we
@@ -1699,11 +1699,11 @@ fn declare_local<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
16991699
};
17001700

17011701
let name = CString::from_slice(name.get().as_bytes());
1702-
let (var_alloca, var_metadata) = match variable_access {
1703-
DirectVariable { alloca } => (
1704-
alloca,
1705-
unsafe {
1706-
llvm::LLVMDIBuilderCreateLocalVariable(
1702+
match (variable_access, [].as_slice()) {
1703+
(DirectVariable { alloca }, address_operations) |
1704+
(IndirectVariable {alloca, address_operations}, _) => {
1705+
let metadata = unsafe {
1706+
llvm::LLVMDIBuilderCreateVariable(
17071707
DIB(cx),
17081708
dwarf_tag,
17091709
scope_metadata,
@@ -1713,38 +1713,25 @@ fn declare_local<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
17131713
type_metadata,
17141714
cx.sess().opts.optimize != config::No,
17151715
0,
1716-
argument_index)
1717-
}
1718-
),
1719-
IndirectVariable { alloca, address_operations } => (
1720-
alloca,
1721-
unsafe {
1722-
llvm::LLVMDIBuilderCreateComplexVariable(
1723-
DIB(cx),
1724-
dwarf_tag,
1725-
scope_metadata,
1726-
name.as_ptr(),
1727-
file_metadata,
1728-
loc.line as c_uint,
1729-
type_metadata,
17301716
address_operations.as_ptr(),
17311717
address_operations.len() as c_uint,
17321718
argument_index)
1733-
}
1734-
)
1735-
};
1736-
1737-
set_debug_location(cx, InternalDebugLocation::new(scope_metadata,
1719+
};
1720+
set_debug_location(cx, InternalDebugLocation::new(scope_metadata,
17381721
loc.line,
17391722
loc.col.to_usize()));
1740-
unsafe {
1741-
let instr = llvm::LLVMDIBuilderInsertDeclareAtEnd(
1742-
DIB(cx),
1743-
var_alloca,
1744-
var_metadata,
1745-
bcx.llbb);
1723+
unsafe {
1724+
let instr = llvm::LLVMDIBuilderInsertDeclareAtEnd(
1725+
DIB(cx),
1726+
alloca,
1727+
metadata,
1728+
address_operations.as_ptr(),
1729+
address_operations.len() as c_uint,
1730+
bcx.llbb);
17461731

1747-
llvm::LLVMSetInstDebugLocation(trans::build::B(bcx).llbuilder, instr);
1732+
llvm::LLVMSetInstDebugLocation(trans::build::B(bcx).llbuilder, instr);
1733+
}
1734+
}
17481735
}
17491736

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

27172704
unsafe {
27182705
let type_array = create_DIArray(DIB(cx), &member_metadata[]);
2719-
llvm::LLVMDICompositeTypeSetTypeArray(composite_type_metadata, type_array);
2706+
llvm::LLVMDICompositeTypeSetTypeArray(DIB(cx), composite_type_metadata, type_array);
27202707
}
27212708
}
27222709

@@ -3150,12 +3137,14 @@ fn set_debug_location(cx: &CrateContext, debug_location: InternalDebugLocation)
31503137
// Always set the column to zero like Clang and GCC
31513138
let col = UNKNOWN_COLUMN_NUMBER;
31523139
debug!("setting debug location to {} {}", line, col);
3153-
let elements = [C_i32(cx, line as i32), C_i32(cx, col as i32),
3154-
scope, ptr::null_mut()];
3140+
31553141
unsafe {
3156-
metadata_node = llvm::LLVMMDNodeInContext(debug_context(cx).llcontext,
3157-
elements.as_ptr(),
3158-
elements.len() as c_uint);
3142+
metadata_node = llvm::LLVMDIBuilderCreateDebugLocation(
3143+
debug_context(cx).llcontext,
3144+
line as c_uint,
3145+
col as c_uint,
3146+
scope,
3147+
ptr::null_mut());
31593148
}
31603149
}
31613150
UnknownLocation => {

branches/auto/src/llvm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit b820135911e17c7a46b901db56baa48e5155bf46
1+
Subproject commit 2d54c4f559b1acbfe1867950c3a25bfb2f76b693

0 commit comments

Comments
 (0)