Avoid splitting up a layout
This commit is contained in:
parent
018032c682
commit
1f34b19596
3 changed files with 24 additions and 22 deletions
|
@ -245,7 +245,7 @@ fn build_pointer_or_reference_di_node<'ll, 'tcx>(
|
|||
cx,
|
||||
owner,
|
||||
addr_field_name,
|
||||
(addr_field.size, addr_field.align.abi),
|
||||
addr_field,
|
||||
layout.fields.offset(WIDE_PTR_ADDR),
|
||||
DIFlags::FlagZero,
|
||||
data_ptr_type_di_node,
|
||||
|
@ -255,7 +255,7 @@ fn build_pointer_or_reference_di_node<'ll, 'tcx>(
|
|||
cx,
|
||||
owner,
|
||||
extra_field_name,
|
||||
(extra_field.size, extra_field.align.abi),
|
||||
extra_field,
|
||||
layout.fields.offset(WIDE_PTR_EXTRA),
|
||||
DIFlags::FlagZero,
|
||||
type_di_node(cx, extra_field.ty),
|
||||
|
@ -738,7 +738,7 @@ fn build_cpp_f16_di_node<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>) -> DINodeCreation
|
|||
cx,
|
||||
float_di_node,
|
||||
"bits",
|
||||
cx.size_and_align_of(bits_ty),
|
||||
cx.layout_of(bits_ty),
|
||||
Size::ZERO,
|
||||
DIFlags::FlagZero,
|
||||
type_di_node(cx, bits_ty),
|
||||
|
@ -972,7 +972,7 @@ fn build_field_di_node<'ll, 'tcx>(
|
|||
cx: &CodegenCx<'ll, 'tcx>,
|
||||
owner: &'ll DIScope,
|
||||
name: &str,
|
||||
size_and_align: (Size, Align),
|
||||
layout: TyAndLayout<'tcx>,
|
||||
offset: Size,
|
||||
flags: DIFlags,
|
||||
type_di_node: &'ll DIType,
|
||||
|
@ -992,8 +992,8 @@ fn build_field_di_node<'ll, 'tcx>(
|
|||
name.len(),
|
||||
file_metadata,
|
||||
line_number,
|
||||
size_and_align.0.bits(),
|
||||
size_and_align.1.bits() as u32,
|
||||
layout.size.bits(),
|
||||
layout.align.abi.bits() as u32,
|
||||
offset.bits(),
|
||||
flags,
|
||||
type_di_node,
|
||||
|
@ -1077,7 +1077,7 @@ fn build_struct_type_di_node<'ll, 'tcx>(
|
|||
cx,
|
||||
owner,
|
||||
&field_name[..],
|
||||
(field_layout.size, field_layout.align.abi),
|
||||
field_layout,
|
||||
struct_type_and_layout.fields.offset(i),
|
||||
visibility_di_flags(cx, f.did, adt_def.did()),
|
||||
type_di_node(cx, field_layout.ty),
|
||||
|
@ -1127,7 +1127,7 @@ fn build_upvar_field_di_nodes<'ll, 'tcx>(
|
|||
cx,
|
||||
closure_or_coroutine_di_node,
|
||||
capture_name.as_str(),
|
||||
cx.size_and_align_of(up_var_ty),
|
||||
cx.layout_of(up_var_ty),
|
||||
layout.fields.offset(index),
|
||||
DIFlags::FlagZero,
|
||||
type_di_node(cx, up_var_ty),
|
||||
|
@ -1172,7 +1172,7 @@ fn build_tuple_type_di_node<'ll, 'tcx>(
|
|||
cx,
|
||||
tuple_di_node,
|
||||
&tuple_field_name(index),
|
||||
cx.size_and_align_of(component_type),
|
||||
cx.layout_of(component_type),
|
||||
tuple_type_and_layout.fields.offset(index),
|
||||
DIFlags::FlagZero,
|
||||
type_di_node(cx, component_type),
|
||||
|
@ -1270,7 +1270,7 @@ fn build_union_type_di_node<'ll, 'tcx>(
|
|||
cx,
|
||||
owner,
|
||||
f.name.as_str(),
|
||||
size_and_align_of(field_layout),
|
||||
field_layout,
|
||||
Size::ZERO,
|
||||
DIFlags::FlagZero,
|
||||
type_di_node(cx, field_layout.ty),
|
||||
|
@ -1418,7 +1418,9 @@ fn build_vtable_type_di_node<'ll, 'tcx>(
|
|||
let void_pointer_ty = Ty::new_imm_ptr(tcx, tcx.types.unit);
|
||||
let void_pointer_type_di_node = type_di_node(cx, void_pointer_ty);
|
||||
let usize_di_node = type_di_node(cx, tcx.types.usize);
|
||||
let (pointer_size, pointer_align) = cx.size_and_align_of(void_pointer_ty);
|
||||
let pointer_layout = cx.layout_of(void_pointer_ty);
|
||||
let pointer_size = pointer_layout.size;
|
||||
let pointer_align = pointer_layout.align.abi;
|
||||
// If `usize` is not pointer-sized and -aligned then the size and alignment computations
|
||||
// for the vtable as a whole would be wrong. Let's make sure this holds even on weird
|
||||
// platforms.
|
||||
|
@ -1474,7 +1476,7 @@ fn build_vtable_type_di_node<'ll, 'tcx>(
|
|||
cx,
|
||||
vtable_type_di_node,
|
||||
&field_name,
|
||||
(pointer_size, pointer_align),
|
||||
pointer_layout,
|
||||
field_offset,
|
||||
DIFlags::FlagZero,
|
||||
field_type_di_node,
|
||||
|
|
|
@ -370,9 +370,9 @@ fn build_single_variant_union_fields<'ll, 'tcx>(
|
|||
cx,
|
||||
enum_type_di_node,
|
||||
&variant_union_field_name(variant_index),
|
||||
// NOTE: We use the size and align of the entire type, not from variant_layout
|
||||
// NOTE: We use the layout of the entire type, not from variant_layout
|
||||
// since the later is sometimes smaller (if it has fewer fields).
|
||||
size_and_align_of(enum_type_and_layout),
|
||||
enum_type_and_layout,
|
||||
Size::ZERO,
|
||||
visibility_flags,
|
||||
variant_struct_type_wrapper_di_node,
|
||||
|
@ -560,7 +560,7 @@ fn build_variant_struct_wrapper_type_di_node<'ll, 'tcx>(
|
|||
cx,
|
||||
wrapper_struct_type_di_node,
|
||||
"value",
|
||||
size_and_align_of(enum_or_coroutine_type_and_layout),
|
||||
enum_or_coroutine_type_and_layout,
|
||||
Size::ZERO,
|
||||
DIFlags::FlagZero,
|
||||
variant_struct_type_di_node,
|
||||
|
@ -874,7 +874,7 @@ fn build_union_fields_for_direct_tag_enum_or_coroutine<'ll, 'tcx>(
|
|||
|
||||
if is_128_bits {
|
||||
let type_di_node = type_di_node(cx, cx.tcx.types.u64);
|
||||
let size_and_align = cx.size_and_align_of(cx.tcx.types.u64);
|
||||
let u64_layout = cx.layout_of(cx.tcx.types.u64);
|
||||
|
||||
let (lo_offset, hi_offset) = match cx.tcx.data_layout.endian {
|
||||
Endian::Little => (0, 8),
|
||||
|
@ -889,7 +889,7 @@ fn build_union_fields_for_direct_tag_enum_or_coroutine<'ll, 'tcx>(
|
|||
cx,
|
||||
enum_type_di_node,
|
||||
TAG_FIELD_NAME_128_LO,
|
||||
size_and_align,
|
||||
u64_layout,
|
||||
lo_offset,
|
||||
di_flags,
|
||||
type_di_node,
|
||||
|
@ -900,7 +900,7 @@ fn build_union_fields_for_direct_tag_enum_or_coroutine<'ll, 'tcx>(
|
|||
cx,
|
||||
enum_type_di_node,
|
||||
TAG_FIELD_NAME_128_HI,
|
||||
size_and_align,
|
||||
u64_layout,
|
||||
hi_offset,
|
||||
DIFlags::FlagZero,
|
||||
type_di_node,
|
||||
|
@ -911,7 +911,7 @@ fn build_union_fields_for_direct_tag_enum_or_coroutine<'ll, 'tcx>(
|
|||
cx,
|
||||
enum_type_di_node,
|
||||
TAG_FIELD_NAME,
|
||||
cx.size_and_align_of(enum_type_and_layout.field(cx, tag_field).ty),
|
||||
enum_type_and_layout.field(cx, tag_field),
|
||||
enum_type_and_layout.fields.offset(tag_field),
|
||||
di_flags,
|
||||
tag_base_type_di_node,
|
||||
|
|
|
@ -249,7 +249,7 @@ fn build_enum_variant_struct_type_di_node<'ll, 'tcx>(
|
|||
cx,
|
||||
struct_type_di_node,
|
||||
&field_name,
|
||||
(field_layout.size, field_layout.align.abi),
|
||||
field_layout,
|
||||
variant_layout.fields.offset(field_index),
|
||||
di_flags,
|
||||
type_di_node(cx, field_layout.ty),
|
||||
|
@ -332,7 +332,7 @@ fn build_coroutine_variant_struct_type_di_node<'ll, 'tcx>(
|
|||
cx,
|
||||
variant_struct_type_di_node,
|
||||
&field_name,
|
||||
cx.size_and_align_of(field_type),
|
||||
cx.layout_of(field_type),
|
||||
variant_layout.fields.offset(field_index),
|
||||
DIFlags::FlagZero,
|
||||
type_di_node(cx, field_type),
|
||||
|
@ -352,7 +352,7 @@ fn build_coroutine_variant_struct_type_di_node<'ll, 'tcx>(
|
|||
cx,
|
||||
variant_struct_type_di_node,
|
||||
upvar_name.as_str(),
|
||||
cx.size_and_align_of(upvar_ty),
|
||||
cx.layout_of(upvar_ty),
|
||||
coroutine_type_and_layout.fields.offset(index),
|
||||
DIFlags::FlagZero,
|
||||
type_di_node(cx, upvar_ty),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue