aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/CBackend
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-03-02 03:33:31 +0000
committerChris Lattner <sabre@nondot.org>2008-03-02 03:33:31 +0000
commitdb6d5ce71848dc49870a3a0ea12fba83a7644cc7 (patch)
treed7aa0f887dc69a8e6578563fcea815fa7757eb7e /lib/Target/CBackend
parent70f0f67675a7bebf6ed6e85c59d171b293717322 (diff)
downloadexternal_llvm-db6d5ce71848dc49870a3a0ea12fba83a7644cc7.zip
external_llvm-db6d5ce71848dc49870a3a0ea12fba83a7644cc7.tar.gz
external_llvm-db6d5ce71848dc49870a3a0ea12fba83a7644cc7.tar.bz2
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
Diffstat (limited to 'lib/Target/CBackend')
-rw-r--r--lib/Target/CBackend/CBackend.cpp21
1 files changed, 11 insertions, 10 deletions
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<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++);