From db6d5ce71848dc49870a3a0ea12fba83a7644cc7 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 2 Mar 2008 03:33:31 +0000 Subject: vector types are simple types. This fixes div/rem of vectors. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47807 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/CBackend/CBackend.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'lib/Target/CBackend') diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index e02f6bc..7ba24a9 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -399,7 +399,7 @@ void CWriter::printStructReturnPointerFunctionType(std::ostream &Out, std::ostream & CWriter::printSimpleType(std::ostream &Out, const Type *Ty, bool isSigned, const std::string &NameSoFar) { - assert((Ty->isPrimitiveType() || Ty->isInteger()) && + assert((Ty->isPrimitiveType() || Ty->isInteger() || isa(Ty)) && "Invalid type for printSimpleType"); switch (Ty->getTypeID()) { case Type::VoidTyID: return Out << "void " << NameSoFar; @@ -425,7 +425,15 @@ CWriter::printSimpleType(std::ostream &Out, const Type *Ty, bool isSigned, case Type::X86_FP80TyID: case Type::PPC_FP128TyID: case Type::FP128TyID: return Out << "long double " << NameSoFar; - default : + + case Type::VectorTyID: { + const VectorType *VTy = cast(Ty); + return printType(Out, VTy->getElementType(), false, + NameSoFar + " __attribute__((vector_size(" + + utostr(TD->getABITypeSize(VTy)) + " ))) "); + } + + default: cerr << "Unknown primitive type: " << *Ty << "\n"; abort(); } @@ -437,7 +445,7 @@ CWriter::printSimpleType(std::ostream &Out, const Type *Ty, bool isSigned, std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty, bool isSigned, const std::string &NameSoFar, bool IgnoreName, const ParamAttrsList* PAL) { - if (Ty->isPrimitiveType() || Ty->isInteger()) { + if (Ty->isPrimitiveType() || Ty->isInteger() || isa(Ty)) { printSimpleType(Out, Ty, isSigned, NameSoFar); return Out; } @@ -517,13 +525,6 @@ std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty, NameSoFar + "[" + utostr(NumElements) + "]"); } - case Type::VectorTyID: { - const VectorType *VTy = cast(Ty); - return printType(Out, VTy->getElementType(), false, - NameSoFar + " __attribute__((vector_size(" + - utostr(TD->getABITypeSize(VTy)) + " ))) "); - } - case Type::OpaqueTyID: { static int Count = 0; std::string TyName = "struct opaque_" + itostr(Count++); -- cgit v1.1