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,
|
cx,
|
||||||
owner,
|
owner,
|
||||||
addr_field_name,
|
addr_field_name,
|
||||||
(addr_field.size, addr_field.align.abi),
|
addr_field,
|
||||||
layout.fields.offset(WIDE_PTR_ADDR),
|
layout.fields.offset(WIDE_PTR_ADDR),
|
||||||
DIFlags::FlagZero,
|
DIFlags::FlagZero,
|
||||||
data_ptr_type_di_node,
|
data_ptr_type_di_node,
|
||||||
|
@ -255,7 +255,7 @@ fn build_pointer_or_reference_di_node<'ll, 'tcx>(
|
||||||
cx,
|
cx,
|
||||||
owner,
|
owner,
|
||||||
extra_field_name,
|
extra_field_name,
|
||||||
(extra_field.size, extra_field.align.abi),
|
extra_field,
|
||||||
layout.fields.offset(WIDE_PTR_EXTRA),
|
layout.fields.offset(WIDE_PTR_EXTRA),
|
||||||
DIFlags::FlagZero,
|
DIFlags::FlagZero,
|
||||||
type_di_node(cx, extra_field.ty),
|
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,
|
cx,
|
||||||
float_di_node,
|
float_di_node,
|
||||||
"bits",
|
"bits",
|
||||||
cx.size_and_align_of(bits_ty),
|
cx.layout_of(bits_ty),
|
||||||
Size::ZERO,
|
Size::ZERO,
|
||||||
DIFlags::FlagZero,
|
DIFlags::FlagZero,
|
||||||
type_di_node(cx, bits_ty),
|
type_di_node(cx, bits_ty),
|
||||||
|
@ -972,7 +972,7 @@ fn build_field_di_node<'ll, 'tcx>(
|
||||||
cx: &CodegenCx<'ll, 'tcx>,
|
cx: &CodegenCx<'ll, 'tcx>,
|
||||||
owner: &'ll DIScope,
|
owner: &'ll DIScope,
|
||||||
name: &str,
|
name: &str,
|
||||||
size_and_align: (Size, Align),
|
layout: TyAndLayout<'tcx>,
|
||||||
offset: Size,
|
offset: Size,
|
||||||
flags: DIFlags,
|
flags: DIFlags,
|
||||||
type_di_node: &'ll DIType,
|
type_di_node: &'ll DIType,
|
||||||
|
@ -992,8 +992,8 @@ fn build_field_di_node<'ll, 'tcx>(
|
||||||
name.len(),
|
name.len(),
|
||||||
file_metadata,
|
file_metadata,
|
||||||
line_number,
|
line_number,
|
||||||
size_and_align.0.bits(),
|
layout.size.bits(),
|
||||||
size_and_align.1.bits() as u32,
|
layout.align.abi.bits() as u32,
|
||||||
offset.bits(),
|
offset.bits(),
|
||||||
flags,
|
flags,
|
||||||
type_di_node,
|
type_di_node,
|
||||||
|
@ -1077,7 +1077,7 @@ fn build_struct_type_di_node<'ll, 'tcx>(
|
||||||
cx,
|
cx,
|
||||||
owner,
|
owner,
|
||||||
&field_name[..],
|
&field_name[..],
|
||||||
(field_layout.size, field_layout.align.abi),
|
field_layout,
|
||||||
struct_type_and_layout.fields.offset(i),
|
struct_type_and_layout.fields.offset(i),
|
||||||
visibility_di_flags(cx, f.did, adt_def.did()),
|
visibility_di_flags(cx, f.did, adt_def.did()),
|
||||||
type_di_node(cx, field_layout.ty),
|
type_di_node(cx, field_layout.ty),
|
||||||
|
@ -1127,7 +1127,7 @@ fn build_upvar_field_di_nodes<'ll, 'tcx>(
|
||||||
cx,
|
cx,
|
||||||
closure_or_coroutine_di_node,
|
closure_or_coroutine_di_node,
|
||||||
capture_name.as_str(),
|
capture_name.as_str(),
|
||||||
cx.size_and_align_of(up_var_ty),
|
cx.layout_of(up_var_ty),
|
||||||
layout.fields.offset(index),
|
layout.fields.offset(index),
|
||||||
DIFlags::FlagZero,
|
DIFlags::FlagZero,
|
||||||
type_di_node(cx, up_var_ty),
|
type_di_node(cx, up_var_ty),
|
||||||
|
@ -1172,7 +1172,7 @@ fn build_tuple_type_di_node<'ll, 'tcx>(
|
||||||
cx,
|
cx,
|
||||||
tuple_di_node,
|
tuple_di_node,
|
||||||
&tuple_field_name(index),
|
&tuple_field_name(index),
|
||||||
cx.size_and_align_of(component_type),
|
cx.layout_of(component_type),
|
||||||
tuple_type_and_layout.fields.offset(index),
|
tuple_type_and_layout.fields.offset(index),
|
||||||
DIFlags::FlagZero,
|
DIFlags::FlagZero,
|
||||||
type_di_node(cx, component_type),
|
type_di_node(cx, component_type),
|
||||||
|
@ -1270,7 +1270,7 @@ fn build_union_type_di_node<'ll, 'tcx>(
|
||||||
cx,
|
cx,
|
||||||
owner,
|
owner,
|
||||||
f.name.as_str(),
|
f.name.as_str(),
|
||||||
size_and_align_of(field_layout),
|
field_layout,
|
||||||
Size::ZERO,
|
Size::ZERO,
|
||||||
DIFlags::FlagZero,
|
DIFlags::FlagZero,
|
||||||
type_di_node(cx, field_layout.ty),
|
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_ty = Ty::new_imm_ptr(tcx, tcx.types.unit);
|
||||||
let void_pointer_type_di_node = type_di_node(cx, void_pointer_ty);
|
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 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
|
// 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
|
// for the vtable as a whole would be wrong. Let's make sure this holds even on weird
|
||||||
// platforms.
|
// platforms.
|
||||||
|
@ -1474,7 +1476,7 @@ fn build_vtable_type_di_node<'ll, 'tcx>(
|
||||||
cx,
|
cx,
|
||||||
vtable_type_di_node,
|
vtable_type_di_node,
|
||||||
&field_name,
|
&field_name,
|
||||||
(pointer_size, pointer_align),
|
pointer_layout,
|
||||||
field_offset,
|
field_offset,
|
||||||
DIFlags::FlagZero,
|
DIFlags::FlagZero,
|
||||||
field_type_di_node,
|
field_type_di_node,
|
||||||
|
|
|
@ -370,9 +370,9 @@ fn build_single_variant_union_fields<'ll, 'tcx>(
|
||||||
cx,
|
cx,
|
||||||
enum_type_di_node,
|
enum_type_di_node,
|
||||||
&variant_union_field_name(variant_index),
|
&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).
|
// 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,
|
Size::ZERO,
|
||||||
visibility_flags,
|
visibility_flags,
|
||||||
variant_struct_type_wrapper_di_node,
|
variant_struct_type_wrapper_di_node,
|
||||||
|
@ -560,7 +560,7 @@ fn build_variant_struct_wrapper_type_di_node<'ll, 'tcx>(
|
||||||
cx,
|
cx,
|
||||||
wrapper_struct_type_di_node,
|
wrapper_struct_type_di_node,
|
||||||
"value",
|
"value",
|
||||||
size_and_align_of(enum_or_coroutine_type_and_layout),
|
enum_or_coroutine_type_and_layout,
|
||||||
Size::ZERO,
|
Size::ZERO,
|
||||||
DIFlags::FlagZero,
|
DIFlags::FlagZero,
|
||||||
variant_struct_type_di_node,
|
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 {
|
if is_128_bits {
|
||||||
let type_di_node = type_di_node(cx, cx.tcx.types.u64);
|
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 {
|
let (lo_offset, hi_offset) = match cx.tcx.data_layout.endian {
|
||||||
Endian::Little => (0, 8),
|
Endian::Little => (0, 8),
|
||||||
|
@ -889,7 +889,7 @@ fn build_union_fields_for_direct_tag_enum_or_coroutine<'ll, 'tcx>(
|
||||||
cx,
|
cx,
|
||||||
enum_type_di_node,
|
enum_type_di_node,
|
||||||
TAG_FIELD_NAME_128_LO,
|
TAG_FIELD_NAME_128_LO,
|
||||||
size_and_align,
|
u64_layout,
|
||||||
lo_offset,
|
lo_offset,
|
||||||
di_flags,
|
di_flags,
|
||||||
type_di_node,
|
type_di_node,
|
||||||
|
@ -900,7 +900,7 @@ fn build_union_fields_for_direct_tag_enum_or_coroutine<'ll, 'tcx>(
|
||||||
cx,
|
cx,
|
||||||
enum_type_di_node,
|
enum_type_di_node,
|
||||||
TAG_FIELD_NAME_128_HI,
|
TAG_FIELD_NAME_128_HI,
|
||||||
size_and_align,
|
u64_layout,
|
||||||
hi_offset,
|
hi_offset,
|
||||||
DIFlags::FlagZero,
|
DIFlags::FlagZero,
|
||||||
type_di_node,
|
type_di_node,
|
||||||
|
@ -911,7 +911,7 @@ fn build_union_fields_for_direct_tag_enum_or_coroutine<'ll, 'tcx>(
|
||||||
cx,
|
cx,
|
||||||
enum_type_di_node,
|
enum_type_di_node,
|
||||||
TAG_FIELD_NAME,
|
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),
|
enum_type_and_layout.fields.offset(tag_field),
|
||||||
di_flags,
|
di_flags,
|
||||||
tag_base_type_di_node,
|
tag_base_type_di_node,
|
||||||
|
|
|
@ -249,7 +249,7 @@ fn build_enum_variant_struct_type_di_node<'ll, 'tcx>(
|
||||||
cx,
|
cx,
|
||||||
struct_type_di_node,
|
struct_type_di_node,
|
||||||
&field_name,
|
&field_name,
|
||||||
(field_layout.size, field_layout.align.abi),
|
field_layout,
|
||||||
variant_layout.fields.offset(field_index),
|
variant_layout.fields.offset(field_index),
|
||||||
di_flags,
|
di_flags,
|
||||||
type_di_node(cx, field_layout.ty),
|
type_di_node(cx, field_layout.ty),
|
||||||
|
@ -332,7 +332,7 @@ fn build_coroutine_variant_struct_type_di_node<'ll, 'tcx>(
|
||||||
cx,
|
cx,
|
||||||
variant_struct_type_di_node,
|
variant_struct_type_di_node,
|
||||||
&field_name,
|
&field_name,
|
||||||
cx.size_and_align_of(field_type),
|
cx.layout_of(field_type),
|
||||||
variant_layout.fields.offset(field_index),
|
variant_layout.fields.offset(field_index),
|
||||||
DIFlags::FlagZero,
|
DIFlags::FlagZero,
|
||||||
type_di_node(cx, field_type),
|
type_di_node(cx, field_type),
|
||||||
|
@ -352,7 +352,7 @@ fn build_coroutine_variant_struct_type_di_node<'ll, 'tcx>(
|
||||||
cx,
|
cx,
|
||||||
variant_struct_type_di_node,
|
variant_struct_type_di_node,
|
||||||
upvar_name.as_str(),
|
upvar_name.as_str(),
|
||||||
cx.size_and_align_of(upvar_ty),
|
cx.layout_of(upvar_ty),
|
||||||
coroutine_type_and_layout.fields.offset(index),
|
coroutine_type_and_layout.fields.offset(index),
|
||||||
DIFlags::FlagZero,
|
DIFlags::FlagZero,
|
||||||
type_di_node(cx, upvar_ty),
|
type_di_node(cx, upvar_ty),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue