[PATCH] D133338: [clang][PowerPC] PPC64 VAArg use coerced integer type for direct aggregate fits in register
Ulrich Weigand via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 7 05:36:49 PDT 2022
uweigand added a comment.
I think it is correct to implement this in Clang. Note that on SystemZ (another big-endian platform), we also implement this in `EmitVAArg`. Of course the details are different since we're not using `emitVoidPtrVAArg` on that platform.
However, I'm not sure if the implementation itself is quite correct, in particular if it is right to just replace the type. Note that looking into `emitVoidPtrVAArg` I see this:
// If the argument is smaller than a slot, and this is a big-endian
// target, the argument will be right-adjusted in its slot.
if (DirectSize < SlotSize && CGF.CGM.getDataLayout().isBigEndian() &&
!DirectTy->isStructTy()) {
Addr = CGF.Builder.CreateConstInBoundsByteGEP(Addr, SlotSize - DirectSize);
}
which seems to implement exactly the same logic, but *without* modifying the type as seen in the IR. It looks like the only change needed for ppc would be to remove the `!DirectTy->isStructTy()` check here? (I guess to avoid inadvertently change other targets, this might need to be triggered by a flag passed as argument. On the other hand, maybe there is no other big-endian platform using `emitVoidPtrVAArg` anyway?)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133338/new/
https://reviews.llvm.org/D133338
More information about the cfe-commits
mailing list