]> granicus.if.org Git - clang/commitdiff
Emit debug info for VectorType.
authorDevang Patel <dpatel@apple.com>
Tue, 23 Feb 2010 22:59:39 +0000 (22:59 +0000)
committerDevang Patel <dpatel@apple.com>
Tue, 23 Feb 2010 22:59:39 +0000 (22:59 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96999 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp
lib/CodeGen/CGDebugInfo.h
test/CodeGen/2010-02-18-Dbg-VectorType.c [new file with mode: 0644]

index 3a27a37988569f3c4691598941b341bc5af10a61..9ed6466af6a58c50870a150629066d97e34fdc61 100644 (file)
@@ -1034,6 +1034,28 @@ llvm::DIType CGDebugInfo::CreateType(const TagType *Ty,
   return llvm::DIType();
 }
 
+llvm::DIType CGDebugInfo::CreateType(const VectorType *Ty,
+                                    llvm::DICompileUnit Unit) {
+  llvm::DIType ElementTy = getOrCreateType(Ty->getElementType(), Unit);
+  uint64_t NumElems = Ty->getNumElements();
+  if (NumElems > 0)
+    --NumElems;
+  llvm::SmallVector<llvm::DIDescriptor, 8> Subscripts;
+  Subscripts.push_back(DebugFactory.GetOrCreateSubrange(0, NumElems));
+
+  llvm::DIArray SubscriptArray =
+    DebugFactory.GetOrCreateArray(Subscripts.data(), Subscripts.size());
+
+  uint64_t Size = CGM.getContext().getTypeSize(Ty);
+  uint64_t Align = CGM.getContext().getTypeAlign(Ty);
+
+  return
+    DebugFactory.CreateCompositeType(llvm::dwarf::DW_TAG_vector_type,
+                                     Unit, "", llvm::DICompileUnit(),
+                                     0, Size, Align, 0, 0,
+                                    ElementTy,  SubscriptArray);
+}
+
 llvm::DIType CGDebugInfo::CreateType(const ArrayType *Ty,
                                      llvm::DICompileUnit Unit) {
   uint64_t Size;
@@ -1214,9 +1236,10 @@ llvm::DIType CGDebugInfo::CreateTypeNode(QualType Ty,
 
   // FIXME: Handle these.
   case Type::ExtVector:
-  case Type::Vector:
     return llvm::DIType();
-      
+
+  case Type::Vector:
+    return CreateType(cast<VectorType>(Ty), Unit);
   case Type::ObjCObjectPointer:
     return CreateType(cast<ObjCObjectPointerType>(Ty), Unit);
   case Type::ObjCInterface:
index b2d3a1f1fa5325012a205c08d2839112ad0a709e..50f575940886f2599accd047d00e37e70a20f675 100644 (file)
@@ -84,6 +84,7 @@ class CGDebugInfo {
   llvm::DIType CreateType(const RecordType *Ty, llvm::DICompileUnit U);
   llvm::DIType CreateType(const ObjCInterfaceType *Ty, llvm::DICompileUnit U);
   llvm::DIType CreateType(const EnumType *Ty, llvm::DICompileUnit U);
+  llvm::DIType CreateType(const VectorType *Ty, llvm::DICompileUnit Unit);
   llvm::DIType CreateType(const ArrayType *Ty, llvm::DICompileUnit U);
   llvm::DIType CreateType(const LValueReferenceType *Ty, llvm::DICompileUnit U);
   llvm::DIType CreateType(const MemberPointerType *Ty, llvm::DICompileUnit U);
diff --git a/test/CodeGen/2010-02-18-Dbg-VectorType.c b/test/CodeGen/2010-02-18-Dbg-VectorType.c
new file mode 100644 (file)
index 0000000..eb17d11
--- /dev/null
@@ -0,0 +1,9 @@
+// RUN: %clang -emit-llvm -S -O0 -g %s -o - | grep DW_TAG_typedef | grep float4
+typedef float float4 __attribute__((vector_size(16)));
+
+int main(){
+  volatile float4 x = (float4) { 0.0f, 1.0f, 2.0f, 3.0f };
+  x += x;
+  return 0;
+}
+