diff --git a/src/librustc_llvm/ffi.rs b/src/librustc_llvm/ffi.rs index 8510b9f523c..07d36448ab0 100644 --- a/src/librustc_llvm/ffi.rs +++ b/src/librustc_llvm/ffi.rs @@ -1369,14 +1369,14 @@ pub fn LLVMRustDIBuilderCreateFunction(Builder: DIBuilderRef, pub fn LLVMRustDIBuilderCreateBasicType(Builder: DIBuilderRef, Name: *const c_char, SizeInBits: u64, - AlignInBits: u64, + AlignInBits: u32, Encoding: c_uint) -> DIBasicType; pub fn LLVMRustDIBuilderCreatePointerType(Builder: DIBuilderRef, PointeeTy: DIType, SizeInBits: u64, - AlignInBits: u64, + AlignInBits: u32, Name: *const c_char) -> DIDerivedType; @@ -1386,7 +1386,7 @@ pub fn LLVMRustDIBuilderCreateStructType(Builder: DIBuilderRef, File: DIFile, LineNumber: c_uint, SizeInBits: u64, - AlignInBits: u64, + AlignInBits: u32, Flags: DIFlags, DerivedFrom: DIType, Elements: DIArray, @@ -1401,7 +1401,7 @@ pub fn LLVMRustDIBuilderCreateMemberType(Builder: DIBuilderRef, File: DIFile, LineNo: c_uint, SizeInBits: u64, - AlignInBits: u64, + AlignInBits: u32, OffsetInBits: u64, Flags: DIFlags, Ty: DIType) @@ -1429,7 +1429,7 @@ pub fn LLVMRustDIBuilderCreateStaticVariable(Builder: DIBuilderRef, isLocalToUnit: bool, Val: ValueRef, Decl: DIDescriptor, - AlignInBits: u64) + AlignInBits: u32) -> DIGlobalVariable; pub fn LLVMRustDIBuilderCreateVariable(Builder: DIBuilderRef, @@ -1442,19 +1442,19 @@ pub fn LLVMRustDIBuilderCreateVariable(Builder: DIBuilderRef, AlwaysPreserve: bool, Flags: DIFlags, ArgNo: c_uint, - AlignInBits: u64) + AlignInBits: u32) -> DIVariable; pub fn LLVMRustDIBuilderCreateArrayType(Builder: DIBuilderRef, Size: u64, - AlignInBits: u64, + AlignInBits: u32, Ty: DIType, Subscripts: DIArray) -> DIType; pub fn LLVMRustDIBuilderCreateVectorType(Builder: DIBuilderRef, Size: u64, - AlignInBits: u64, + AlignInBits: u32, Ty: DIType, Subscripts: DIArray) -> DIType; @@ -1489,7 +1489,7 @@ pub fn LLVMRustDIBuilderCreateEnumerationType(Builder: DIBuilderRef, File: DIFile, LineNumber: c_uint, SizeInBits: u64, - AlignInBits: u64, + AlignInBits: u32, Elements: DIArray, ClassType: DIType) -> DIType; @@ -1500,7 +1500,7 @@ pub fn LLVMRustDIBuilderCreateUnionType(Builder: DIBuilderRef, File: DIFile, LineNumber: c_uint, SizeInBits: u64, - AlignInBits: u64, + AlignInBits: u32, Flags: DIFlags, Elements: DIArray, RunTimeLang: c_uint, diff --git a/src/librustc_trans/debuginfo/metadata.rs b/src/librustc_trans/debuginfo/metadata.rs index c83e2f4854b..7578cc74dbf 100644 --- a/src/librustc_trans/debuginfo/metadata.rs +++ b/src/librustc_trans/debuginfo/metadata.rs @@ -1783,7 +1783,7 @@ pub fn create_global_var_metadata(cx: &CrateContext, is_local_to_unit, global, ptr::null_mut(), - global_align as u64, + global_align, ); } } diff --git a/src/librustc_trans/debuginfo/mod.rs b/src/librustc_trans/debuginfo/mod.rs index 501f891befa..729eae15ad6 100644 --- a/src/librustc_trans/debuginfo/mod.rs +++ b/src/librustc_trans/debuginfo/mod.rs @@ -464,7 +464,7 @@ pub fn declare_local<'a, 'tcx>(bcx: &Builder<'a, 'tcx>, cx.sess().opts.optimize != config::OptLevel::No, DIFlags::FlagZero, argument_index, - align as u64, + align, ) }; source_loc::set_debug_location(bcx, diff --git a/src/librustc_trans/debuginfo/utils.rs b/src/librustc_trans/debuginfo/utils.rs index 8d634c0e292..15a1c990aad 100644 --- a/src/librustc_trans/debuginfo/utils.rs +++ b/src/librustc_trans/debuginfo/utils.rs @@ -24,6 +24,8 @@ use syntax_pos::{self, Span}; use syntax::ast; +use std::ops; + pub fn is_node_local_to_unit(cx: &CrateContext, node_id: ast::NodeId) -> bool { // The is_local_to_unit flag indicates whether a function is local to the @@ -49,12 +51,13 @@ pub fn span_start(cx: &CrateContext, span: Span) -> syntax_pos::Loc { cx.sess().codemap().lookup_char_pos(span.lo) } -pub fn size_and_align_of(cx: &CrateContext, llvm_type: Type) -> (u64, u64) { - (machine::llsize_of_alloc(cx, llvm_type), machine::llalign_of_min(cx, llvm_type) as u64) +pub fn size_and_align_of(cx: &CrateContext, llvm_type: Type) -> (u64, u32) { + (machine::llsize_of_alloc(cx, llvm_type), machine::llalign_of_min(cx, llvm_type)) } -pub fn bytes_to_bits(bytes: u64) -> u64 { - bytes * 8 +pub fn bytes_to_bits(bytes: T) -> T + where T: ops::Mul + From { + bytes * 8u8.into() } #[inline] diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp index c7bcd255818..4e201c254e3 100644 --- a/src/rustllvm/RustWrapper.cpp +++ b/src/rustllvm/RustWrapper.cpp @@ -513,7 +513,7 @@ extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreateFunction( extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreateBasicType(LLVMRustDIBuilderRef Builder, const char *Name, - uint64_t SizeInBits, uint64_t AlignInBits, + uint64_t SizeInBits, uint32_t AlignInBits, unsigned Encoding) { return wrap(Builder->createBasicType(Name, SizeInBits, #if LLVM_VERSION_LE(3, 9) @@ -524,7 +524,7 @@ LLVMRustDIBuilderCreateBasicType(LLVMRustDIBuilderRef Builder, const char *Name, extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreatePointerType( LLVMRustDIBuilderRef Builder, LLVMRustMetadataRef PointeeTy, - uint64_t SizeInBits, uint64_t AlignInBits, const char *Name) { + uint64_t SizeInBits, uint32_t AlignInBits, const char *Name) { return wrap(Builder->createPointerType(unwrapDI(PointeeTy), SizeInBits, AlignInBits, Name)); } @@ -532,7 +532,7 @@ extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreatePointerType( extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreateStructType( LLVMRustDIBuilderRef Builder, LLVMRustMetadataRef Scope, const char *Name, LLVMRustMetadataRef File, unsigned LineNumber, uint64_t SizeInBits, - uint64_t AlignInBits, LLVMRustDIFlags Flags, + uint32_t AlignInBits, LLVMRustDIFlags Flags, LLVMRustMetadataRef DerivedFrom, LLVMRustMetadataRef Elements, unsigned RunTimeLang, LLVMRustMetadataRef VTableHolder, const char *UniqueId) { @@ -546,7 +546,7 @@ extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreateStructType( extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreateMemberType( LLVMRustDIBuilderRef Builder, LLVMRustMetadataRef Scope, const char *Name, LLVMRustMetadataRef File, unsigned LineNo, uint64_t SizeInBits, - uint64_t AlignInBits, uint64_t OffsetInBits, LLVMRustDIFlags Flags, + uint32_t AlignInBits, uint64_t OffsetInBits, LLVMRustDIFlags Flags, LLVMRustMetadataRef Ty) { return wrap(Builder->createMemberType(unwrapDI(Scope), Name, unwrapDI(File), LineNo, @@ -573,7 +573,7 @@ extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreateStaticVariable( LLVMRustDIBuilderRef Builder, LLVMRustMetadataRef Context, const char *Name, const char *LinkageName, LLVMRustMetadataRef File, unsigned LineNo, LLVMRustMetadataRef Ty, bool IsLocalToUnit, LLVMValueRef V, - LLVMRustMetadataRef Decl = nullptr, uint64_t AlignInBits = 0) { + LLVMRustMetadataRef Decl = nullptr, uint32_t AlignInBits = 0) { Constant *InitVal = cast(unwrap(V)); #if LLVM_VERSION_GE(4, 0) @@ -612,7 +612,7 @@ extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreateVariable( LLVMRustDIBuilderRef Builder, unsigned Tag, LLVMRustMetadataRef Scope, const char *Name, LLVMRustMetadataRef File, unsigned LineNo, LLVMRustMetadataRef Ty, bool AlwaysPreserve, LLVMRustDIFlags Flags, - unsigned ArgNo, uint64_t AlignInBits) { + unsigned ArgNo, uint32_t AlignInBits) { #if LLVM_VERSION_GE(3, 8) if (Tag == 0x100) { // DW_TAG_auto_variable return wrap(Builder->createAutoVariable( @@ -637,7 +637,7 @@ extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreateVariable( extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreateArrayType(LLVMRustDIBuilderRef Builder, uint64_t Size, - uint64_t AlignInBits, LLVMRustMetadataRef Ty, + uint32_t AlignInBits, LLVMRustMetadataRef Ty, LLVMRustMetadataRef Subscripts) { return wrap( Builder->createArrayType(Size, AlignInBits, unwrapDI(Ty), @@ -646,7 +646,7 @@ LLVMRustDIBuilderCreateArrayType(LLVMRustDIBuilderRef Builder, uint64_t Size, extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreateVectorType(LLVMRustDIBuilderRef Builder, uint64_t Size, - uint64_t AlignInBits, LLVMRustMetadataRef Ty, + uint32_t AlignInBits, LLVMRustMetadataRef Ty, LLVMRustMetadataRef Subscripts) { return wrap( Builder->createVectorType(Size, AlignInBits, unwrapDI(Ty), @@ -687,7 +687,7 @@ LLVMRustDIBuilderCreateEnumerator(LLVMRustDIBuilderRef Builder, extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreateEnumerationType( LLVMRustDIBuilderRef Builder, LLVMRustMetadataRef Scope, const char *Name, LLVMRustMetadataRef File, unsigned LineNumber, uint64_t SizeInBits, - uint64_t AlignInBits, LLVMRustMetadataRef Elements, + uint32_t AlignInBits, LLVMRustMetadataRef Elements, LLVMRustMetadataRef ClassTy) { return wrap(Builder->createEnumerationType( unwrapDI(Scope), Name, unwrapDI(File), LineNumber, @@ -698,7 +698,7 @@ extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreateEnumerationType( extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreateUnionType( LLVMRustDIBuilderRef Builder, LLVMRustMetadataRef Scope, const char *Name, LLVMRustMetadataRef File, unsigned LineNumber, uint64_t SizeInBits, - uint64_t AlignInBits, LLVMRustDIFlags Flags, LLVMRustMetadataRef Elements, + uint32_t AlignInBits, LLVMRustDIFlags Flags, LLVMRustMetadataRef Elements, unsigned RunTimeLang, const char *UniqueId) { return wrap(Builder->createUnionType( unwrapDI(Scope), Name, unwrapDI(File), LineNumber,