summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-03-02 03:29:50 +0000
committerChris Lattner <sabre@nondot.org>2008-03-02 03:29:50 +0000
commitb104be599a73b47206a7ef69a57a6d6bfd0af0b9 (patch)
tree90b44b016eb543136f15b08932b8b4697f055eb7 /llvm/lib
parentc8d974a3234e6597c63609aa222757c0af393eb1 (diff)
downloadbcm5719-llvm-b104be599a73b47206a7ef69a57a6d6bfd0af0b9.tar.gz
bcm5719-llvm-b104be599a73b47206a7ef69a57a6d6bfd0af0b9.zip
Print vector types appropriately. This gets basic vector code working
(PR1126) llvm-svn: 47806
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/CBackend/CBackend.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Target/CBackend/CBackend.cpp b/llvm/lib/Target/CBackend/CBackend.cpp
index 3b28484a906..e02f6bc8a26 100644
--- a/llvm/lib/Target/CBackend/CBackend.cpp
+++ b/llvm/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 {
OpenPOWER on IntegriCloud