Flatten float complex arguments. N32/64 requires float complex arguments be

passed in floating point registers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147892 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Akira Hatanaka 2012-01-10 23:12:19 +00:00
Родитель 9659d59ec3
Коммит 6d1080fd18
1 изменённых файлов: 28 добавлений и 4 удалений

Просмотреть файл

@ -3040,7 +3040,8 @@ namespace {
class MipsABIInfo : public ABIInfo {
bool IsO32;
unsigned MinABIStackAlignInBytes;
llvm::Type* HandleStructTy(QualType Ty) const;
llvm::Type* GetFloatingPointTy(const BuiltinType *BT) const;
llvm::Type* HandleAggregates(QualType Ty) const;
llvm::Type* returnAggregateInRegs(QualType RetTy, uint64_t Size) const;
llvm::Type* getPaddingType(uint64_t Align, uint64_t Offset) const;
public:
@ -3074,12 +3075,36 @@ public:
};
}
llvm::Type *MipsABIInfo::GetFloatingPointTy(const BuiltinType *BT) const {
switch (BT->getKind()) {
case BuiltinType::Float:
return llvm::Type::getFloatTy(getVMContext());
case BuiltinType::Double:
return llvm::Type::getDoubleTy(getVMContext());
case BuiltinType::LongDouble:
return llvm::Type::getFP128Ty(getVMContext());
default:
assert(false && "Unexpected floating point type.");
return 0;
}
}
// In N32/64, an aligned double precision floating point field is passed in
// a register.
llvm::Type* MipsABIInfo::HandleStructTy(QualType Ty) const {
llvm::Type* MipsABIInfo::HandleAggregates(QualType Ty) const {
if (IsO32)
return 0;
SmallVector<llvm::Type*, 8> ArgList;
if (Ty->isComplexType()) {
const ComplexType *CT = Ty->getAs<ComplexType>();
const BuiltinType *BT = CT->getElementType()->getAs<BuiltinType>();
llvm::Type *FT = GetFloatingPointTy(BT);
ArgList.append(2, FT);
return llvm::StructType::get(getVMContext(), ArgList);
}
const RecordType *RT = Ty->getAsStructureType();
if (!RT)
@ -3090,7 +3115,6 @@ llvm::Type* MipsABIInfo::HandleStructTy(QualType Ty) const {
uint64_t StructSize = getContext().getTypeSize(Ty);
assert(!(StructSize % 8) && "Size of structure must be multiple of 8.");
SmallVector<llvm::Type*, 8> ArgList;
uint64_t LastOffset = 0;
unsigned idx = 0;
llvm::IntegerType *I64 = llvm::IntegerType::get(getVMContext(), 64);
@ -3168,7 +3192,7 @@ MipsABIInfo::classifyArgumentType(QualType Ty, uint64_t &Offset) const {
// byval pointer or directly by coercing to another structure type. In the
// latter case, padding is inserted if the offset of the aggregate is
// unaligned.
llvm::Type *ResType = HandleStructTy(Ty);
llvm::Type *ResType = HandleAggregates(Ty);
if (!ResType)
return ABIArgInfo::getIndirect(0);