[cfe-commits] r143596 - /cfe/trunk/lib/CodeGen/TargetInfo.cpp
Hatanaka, Akira
ahatanaka at mips.com
Thu Jan 5 16:21:23 PST 2012
Yes, we should insert padding for types that are not Struct too.
Can we assume PaddingType is valid only if ABIArgInfo's TheKind is Direct? Or should other we be able to add PaddingType for other Kinds as well?
________________________________________
From: Eli Friedman [eli.friedman at gmail.com]
Sent: Thursday, January 05, 2012 3:16 PM
To: Hatanaka, Akira
Cc: cfe-commits at cs.uiuc.edu
Subject: Re: [cfe-commits] r143596 - /cfe/trunk/lib/CodeGen/TargetInfo.cpp
On Thu, Jan 5, 2012 at 12:47 PM, Hatanaka, Akira <ahatanaka at mips.com> wrote:
> Please review the attached patch.
>
> I added comments and changed the type of ABIArgInfo's padding to llvm::Type*.
@@ -691,6 +691,9 @@
// generally likes scalar values better than FCAs.
llvm::Type *argType = argAI.getCoerceToType();
if (llvm::StructType *st = dyn_cast<llvm::StructType>(argType)) {
+ // Insert a padding type to ensure proper alignment.
+ if (llvm::Type *PaddingType = argAI.getPaddingType())
+ argTypes.push_back(PaddingType);
for (unsigned i = 0, e = st->getNumElements(); i != e; ++i)
argTypes.push_back(st->getElementType(i));
} else {
Shouldn't we be inserting the padding independent of whether the
following type is a struct type?
Looks fine otherwise.
-Eli
More information about the cfe-commits
mailing list