Use a single integer type for a sub-doubleword part of a byval structure.

llvm-svn: 143666
This commit is contained in:
Akira Hatanaka 2011-11-03 23:31:00 +00:00
parent 1bd49deec0
commit f3879ee666
1 changed files with 4 additions and 11 deletions

View File

@ -3082,18 +3082,11 @@ llvm::Type* MipsABIInfo::HandleStructTy(QualType Ty) const {
for (unsigned N = (StructSize - LastOffset) / 64; N; --N) for (unsigned N = (StructSize - LastOffset) / 64; N; --N)
ArgList.push_back(I64); ArgList.push_back(I64);
// Whatever is left over goes into a structure consisting of sub-doubleword // If the size of the remainder is not zero, add one more integer type to
// types. For example, if the size of the remainder is 40-bytes, // ArgList.
// struct {i32, i8} is added to ArgList.
unsigned R = (StructSize - LastOffset) % 64; unsigned R = (StructSize - LastOffset) % 64;
SmallVector<llvm::Type*, 3> ArgList2; if (R)
ArgList.push_back(llvm::IntegerType::get(getVMContext(), R));
for (; R; R &= (R - 1))
ArgList2.insert(ArgList2.begin(),
llvm::IntegerType::get(getVMContext(), (R & (R - 1)) ^ R));
if (!ArgList2.empty())
ArgList.push_back(llvm::StructType::get(getVMContext(), ArgList2));
return llvm::StructType::get(getVMContext(), ArgList); return llvm::StructType::get(getVMContext(), ArgList);
} }