vector types are simple types. This fixes div/rem of vectors.
authorChris Lattner <sabre@nondot.org>
Sun, 2 Mar 2008 03:33:31 +0000 (03:33 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 2 Mar 2008 03:33:31 +0000 (03:33 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47807 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/CBackend/CBackend.cpp

index e02f6bc8a26b57c146d82229a3f41ddf4f5e1a24..7ba24a947411955a142300f60b7cf3dd02238762 100644 (file)
@@ -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<VectorType>(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<VectorType>(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<VectorType>(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<VectorType>(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++);