diff options
author | Chris Lattner <sabre@nondot.org> | 2008-03-02 03:29:50 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-03-02 03:29:50 +0000 |
commit | 85feab6c571c664d7b271a32beabcb7a1ab44dfb (patch) | |
tree | 09d69a7089f3ee76840c1e8b0b4a46f26daa6ebe /lib/Target/CBackend/CBackend.cpp | |
parent | 0a3d4d971de92ef6d78d642609c4cc32b458a954 (diff) |
Print vector types appropriately. This gets basic vector code working
(PR1126)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47806 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/CBackend/CBackend.cpp')
-rw-r--r-- | lib/Target/CBackend/CBackend.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index 3b28484a90..e02f6bc8a2 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -519,9 +519,9 @@ std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty, case Type::VectorTyID: { const VectorType *VTy = cast<VectorType>(Ty); - unsigned NumElements = VTy->getNumElements(); return printType(Out, VTy->getElementType(), false, - NameSoFar + "[" + utostr(NumElements) + "]"); + NameSoFar + " __attribute__((vector_size(" + + utostr(TD->getABITypeSize(VTy)) + " ))) "); } case Type::OpaqueTyID: { @@ -991,6 +991,10 @@ void CWriter::printConstant(Constant *CPV) { break; case Type::VectorTyID: + // Use C99 compound expression literal initializer syntax. + Out << "("; + printType(Out, CPV->getType()); + Out << ")"; if (ConstantVector *CV = cast<ConstantVector>(CPV)) { printConstantVector(CV); } else { |