authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-12-30 20:54:24+02:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-12-30 21:24:40+02:00
logbd711dfd255447883d25f422031592e3824ca296
treeb3360e1780cd933d5ae79a16a141338fad11d557
parentf874b5e1e08860c169b9a318391aabedfd3f7ff0

llvm: do not pad vector element debug types


1 files changed, 22 insertions(+), 1 deletions(-)

src/codegen/llvm.zig+22-1
......@@ -1725,10 +1725,31 @@ pub const Object = struct {
17251725 return array_di_ty;
17261726 },
17271727 .Vector => {
1728 const elem_ty = ty.elemType2();
1729 // Vector elements cannot be padded since that would make
1730 // @bitSizOf(elem) * len > @bitSizOf(vec).
1731 // Neither gdb nor lldb seem to be able to display non-byte sized
1732 // vectors properly.
1733 const elem_di_type = switch (elem_ty.zigTypeTag()) {
1734 .Int => blk: {
1735 const info = elem_ty.intInfo(target);
1736 assert(info.bits != 0);
1737 const name = try ty.nameAlloc(gpa, o.module);
1738 defer gpa.free(name);
1739 const dwarf_encoding: c_uint = switch (info.signedness) {
1740 .signed => DW.ATE.signed,
1741 .unsigned => DW.ATE.unsigned,
1742 };
1743 break :blk dib.createBasicType(name, info.bits, dwarf_encoding);
1744 },
1745 .Bool => dib.createBasicType("bool", 1, DW.ATE.boolean),
1746 else => try o.lowerDebugType(ty.childType(), .full),
1747 };
1748
17281749 const vector_di_ty = dib.createVectorType(
17291750 ty.abiSize(target) * 8,
17301751 ty.abiAlignment(target) * 8,
1731 try o.lowerDebugType(ty.childType(), .full),
1752 elem_di_type,
17321753 ty.vectorLen(),
17331754 );
17341755 // The recursive call to `lowerDebugType` means we can't use `gop` anymore.