Merge pull request #3868 from kinke/di_ptr

DI: Don't emit explicit alignment for pointer types
This commit is contained in:
Martin Kinkelin 2022-02-26 14:36:57 +01:00 committed by GitHub
parent 222f4df356
commit 4e061791b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -370,8 +370,6 @@ DIType DIBuilder::CreateEnumType(TypeEnum *type) {
}
DIType DIBuilder::CreatePointerType(TypePointer *type) {
llvm::Type *T = DtoType(type);
// TODO: The addressspace is important for dcompute targets. See e.g.
// https://www.mail-archive.com/dwarf-discuss@lists.dwarfstd.org/msg00326.html
const llvm::Optional<unsigned> DWARFAddressSpace = llvm::None;
@ -380,9 +378,7 @@ DIType DIBuilder::CreatePointerType(TypePointer *type) {
return DBuilder.createPointerType(
CreateTypeDescription(type->nextOf(), /*voidToUbyte=*/true),
getTypeAllocSize(T) * 8, // size (bits)
getABITypeAlign(T) * 8, // align (bits)
DWARFAddressSpace, name);
target.ptrsize * 8, 0, DWARFAddressSpace, name);
}
DIType DIBuilder::CreateVectorType(TypeVector *type) {
@ -775,9 +771,9 @@ DIType DIBuilder::CreateTypeDescription(Type *t, bool voidToUbyte) {
return nullptr;
if (t->ty == TY::Tnull) {
// display null as void*
return DBuilder.createPointerType(CreateTypeDescription(Type::tvoid), 8, 8,
/* DWARFAddressSpace */ llvm::None,
"typeof(null)");
return DBuilder.createPointerType(
CreateTypeDescription(Type::tvoid), target.ptrsize * 8, 0,
/* DWARFAddressSpace */ llvm::None, "typeof(null)");
}
if (auto te = t->isTypeEnum())
return CreateEnumType(te);
@ -796,13 +792,11 @@ DIType DIBuilder::CreateTypeDescription(Type *t, bool voidToUbyte) {
if (t->ty == TY::Tstruct)
return CreateCompositeType(t);
if (auto tc = t->isTypeClass()) {
LLType *T = DtoType(t);
const auto aggregateDIType = CreateCompositeType(t);
const auto name =
(tc->sym->toPrettyChars(true) + llvm::StringRef("*")).str();
return DBuilder.createPointerType(aggregateDIType, getTypeAllocSize(T) * 8,
getABITypeAlign(T) * 8, llvm::None,
processDIName(name));
return DBuilder.createPointerType(aggregateDIType, target.ptrsize * 8, 0,
llvm::None, processDIName(name));
}
if (auto tf = t->isTypeFunction())
return CreateFunctionType(tf);