Honor ByVal alignment. Patch by Nate Begeman!

llvm-svn: 63811
This commit is contained in:
Daniel Dunbar 2009-02-05 01:31:19 +00:00
parent 4e87c834d3
commit 0103574d55
1 changed files with 3 additions and 2 deletions

View File

@ -316,6 +316,7 @@ ABIArgInfo X86_32ABIInfo::classifyReturnType(QualType RetTy,
ABIArgInfo X86_32ABIInfo::classifyArgumentType(QualType Ty, ABIArgInfo X86_32ABIInfo::classifyArgumentType(QualType Ty,
ASTContext &Context) const { ASTContext &Context) const {
// FIXME: Set alignment on byval arguments.
if (CodeGenFunction::hasAggregateLLVMType(Ty)) { if (CodeGenFunction::hasAggregateLLVMType(Ty)) {
// Structures with flexible arrays are always byval. // Structures with flexible arrays are always byval.
if (const RecordType *RT = Ty->getAsStructureType()) if (const RecordType *RT = Ty->getAsStructureType())
@ -1066,7 +1067,6 @@ CodeGenTypes::GetFunctionType(const CGFunctionInfo &FI, bool IsVariadic) {
case ABIArgInfo::ByVal: case ABIArgInfo::ByVal:
// byval arguments are always on the stack, which is addr space #0. // byval arguments are always on the stack, which is addr space #0.
ArgTys.push_back(llvm::PointerType::getUnqual(Ty)); ArgTys.push_back(llvm::PointerType::getUnqual(Ty));
assert(AI.getByValAlignment() == 0 && "FIXME: alignment unhandled");
break; break;
case ABIArgInfo::Direct: case ABIArgInfo::Direct:
@ -1146,7 +1146,8 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI,
case ABIArgInfo::ByVal: case ABIArgInfo::ByVal:
Attributes |= llvm::Attribute::ByVal; Attributes |= llvm::Attribute::ByVal;
assert(AI.getByValAlignment() == 0 && "FIXME: alignment unhandled"); Attributes |=
llvm::Attribute::constructAlignmentFromInt(AI.getByValAlignment());
break; break;
case ABIArgInfo::Direct: case ABIArgInfo::Direct: