[cfe-commits] r147892 - /cfe/trunk/lib/CodeGen/TargetInfo.cpp

Hatanaka, Akira ahatanaka at mips.com
Wed Jan 11 17:12:29 PST 2012


I committed the changes in r147985.

Thank you.
________________________________________
From: Eli Friedman [eli.friedman at gmail.com]
Sent: Tuesday, January 10, 2012 3:45 PM
To: Hatanaka, Akira
Cc: cfe-commits at cs.uiuc.edu
Subject: Re: [cfe-commits] r147892 - /cfe/trunk/lib/CodeGen/TargetInfo.cpp

On Tue, Jan 10, 2012 at 3:12 PM, Akira Hatanaka <ahatanaka at mips.com> wrote:
> Author: ahatanak
> Date: Tue Jan 10 17:12:19 2012
> New Revision: 147892
>
> URL: http://llvm.org/viewvc/llvm-project?rev=147892&view=rev
> Log:
> Flatten float complex arguments. N32/64 requires float complex arguments be
> passed in floating point registers.
>
>
> Modified:
>    cfe/trunk/lib/CodeGen/TargetInfo.cpp
>
> Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=147892&r1=147891&r2=147892&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
> +++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Tue Jan 10 17:12:19 2012
> @@ -3040,7 +3040,8 @@
>  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 @@
>  };
>  }
>
> +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);
> +  }

You should be able to replace this with just "if (Ty->isComplexType())
return CGT.ConvertType(T);"

-Eli




More information about the cfe-commits mailing list