vector types are simple types. This fixes div/rem of vectors.

llvm-svn: 47807
This commit is contained in:
Chris Lattner 2008-03-02 03:33:31 +00:00
parent 8eddd5055d
commit 112819e1e6

View 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++);