[llvm-commits] [llvm] r47807 - /llvm/trunk/lib/Target/CBackend/CBackend.cpp

Chris Lattner sabre at nondot.org
Sat Mar 1 19:33:31 PST 2008


Author: lattner
Date: Sat Mar  1 21:33:31 2008
New Revision: 47807

URL: http://llvm.org/viewvc/llvm-project?rev=47807&view=rev
Log:
vector types are simple types.  This fixes div/rem of vectors.

Modified:
    llvm/trunk/lib/Target/CBackend/CBackend.cpp

Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CBackend/CBackend.cpp?rev=47807&r1=47806&r2=47807&view=diff

==============================================================================
--- llvm/trunk/lib/Target/CBackend/CBackend.cpp (original)
+++ llvm/trunk/lib/Target/CBackend/CBackend.cpp Sat Mar  1 21:33:31 2008
@@ -399,7 +399,7 @@
 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 @@
   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 @@
 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 @@
                      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++);





More information about the llvm-commits mailing list