Use u32 for alignments instead of u64
This commit is contained in:
parent
b4e6f70eda
commit
c7bea76091
3 changed files with 17 additions and 14 deletions
|
|
@ -299,7 +299,7 @@ fn fixed_vec_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
|
|||
llvm::LLVMRustDIBuilderCreateArrayType(
|
||||
DIB(cx),
|
||||
bytes_to_bits(array_size_in_bytes),
|
||||
bytes_to_bits(element_type_align) as u32,
|
||||
bytes_to_bits(element_type_align),
|
||||
element_type_metadata,
|
||||
subscripts)
|
||||
};
|
||||
|
|
@ -730,7 +730,7 @@ fn basic_type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
|
|||
DIB(cx),
|
||||
name.as_ptr(),
|
||||
bytes_to_bits(size),
|
||||
bytes_to_bits(align) as u32,
|
||||
bytes_to_bits(align),
|
||||
encoding)
|
||||
};
|
||||
|
||||
|
|
@ -750,7 +750,7 @@ fn pointer_type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
|
|||
DIB(cx),
|
||||
pointee_type_metadata,
|
||||
bytes_to_bits(pointer_size),
|
||||
bytes_to_bits(pointer_align) as u32,
|
||||
bytes_to_bits(pointer_align),
|
||||
name.as_ptr())
|
||||
};
|
||||
return ptr_metadata;
|
||||
|
|
@ -1504,7 +1504,7 @@ fn prepare_enum_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
|
|||
file_metadata,
|
||||
UNKNOWN_LINE_NUMBER,
|
||||
bytes_to_bits(discriminant_size),
|
||||
bytes_to_bits(discriminant_align) as u32,
|
||||
bytes_to_bits(discriminant_align),
|
||||
create_DIArray(DIB(cx), &enumerators_metadata),
|
||||
discriminant_base_type_metadata)
|
||||
};
|
||||
|
|
@ -1546,7 +1546,7 @@ fn prepare_enum_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
|
|||
file_metadata,
|
||||
UNKNOWN_LINE_NUMBER,
|
||||
bytes_to_bits(enum_type_size),
|
||||
bytes_to_bits(enum_type_align) as u32,
|
||||
bytes_to_bits(enum_type_align),
|
||||
DIFlags::FlagZero,
|
||||
ptr::null_mut(),
|
||||
0, // RuntimeLang
|
||||
|
|
@ -1648,7 +1648,7 @@ fn set_members_of_composite_type(cx: &CrateContext,
|
|||
unknown_file_metadata(cx),
|
||||
UNKNOWN_LINE_NUMBER,
|
||||
bytes_to_bits(member_size),
|
||||
bytes_to_bits(member_align) as u32,
|
||||
bytes_to_bits(member_align),
|
||||
bytes_to_bits(member_offset),
|
||||
member_description.flags,
|
||||
member_description.type_metadata)
|
||||
|
|
@ -1691,7 +1691,7 @@ fn create_struct_stub(cx: &CrateContext,
|
|||
unknown_file_metadata(cx),
|
||||
UNKNOWN_LINE_NUMBER,
|
||||
bytes_to_bits(struct_size),
|
||||
bytes_to_bits(struct_align) as u32,
|
||||
bytes_to_bits(struct_align),
|
||||
DIFlags::FlagZero,
|
||||
ptr::null_mut(),
|
||||
empty_array,
|
||||
|
|
@ -1728,7 +1728,7 @@ fn create_union_stub(cx: &CrateContext,
|
|||
unknown_file_metadata(cx),
|
||||
UNKNOWN_LINE_NUMBER,
|
||||
bytes_to_bits(union_size),
|
||||
bytes_to_bits(union_align) as u32,
|
||||
bytes_to_bits(union_align),
|
||||
DIFlags::FlagZero,
|
||||
empty_array,
|
||||
0, // RuntimeLang
|
||||
|
|
@ -1783,7 +1783,7 @@ pub fn create_global_var_metadata(cx: &CrateContext,
|
|||
is_local_to_unit,
|
||||
global,
|
||||
ptr::null_mut(),
|
||||
global_align as u32,
|
||||
global_align,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 u32,
|
||||
align,
|
||||
)
|
||||
};
|
||||
source_loc::set_debug_location(bcx,
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ use type_::Type;
|
|||
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<T>(bytes: T) -> T
|
||||
where T: ops::Mul<Output=T> + From<u8> {
|
||||
bytes * 8u8.into()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue