AArch64: Populate a struct's argTypes

The only observable effect for now is that non-Apple AArch64
TypeInfo_Struct emissions might contain a populated m_arg1, which is
a prerequisite for TypeInfo-based core.vararg.va_arg().
This commit is contained in:
Martin Kinkelin 2020-05-02 03:22:17 +02:00
parent a994c6b87a
commit 6d7819f8c6

View file

@ -26,6 +26,8 @@ using llvm::APFloat;
TypeTuple *toArgTypes(Type *t);
// in dmd/argtypes_sysv_x64.d:
TypeTuple *toArgTypes_sysv_x64(Type *t);
// in dmd/argtypes_aarch64.d:
TypeTuple *toArgTypes_aarch64(Type *t);
namespace {
/******************************
@ -200,10 +202,13 @@ const char *TargetCPP::typeMangle(Type *t) {
TypeTuple *Target::toArgTypes(Type *t) {
const auto &triple = *global.params.targetTriple;
if (triple.getArch() == llvm::Triple::x86)
const auto arch = triple.getArch();
if (arch == llvm::Triple::x86)
return ::toArgTypes(t);
if (triple.getArch() == llvm::Triple::x86_64 && !triple.isOSWindows())
if (arch == llvm::Triple::x86_64 && !triple.isOSWindows())
return toArgTypes_sysv_x64(t);
if (arch == llvm::Triple::aarch64 || arch == llvm::Triple::aarch64_be)
return toArgTypes_aarch64(t);
return nullptr;
}