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 [[email protected]] Sent: Thursday, January 05, 2012 3:16 PM To: Hatanaka, Akira Cc: [email protected] Subject: Re: [cfe-commits] r143596 - /cfe/trunk/lib/CodeGen/TargetInfo.cpp On Thu, Jan 5, 2012 at 12:47 PM, Hatanaka, Akira <[email protected]> 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 _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
