[cfe-commits] r96999 - in /cfe/trunk: lib/CodeGen/CGDebugInfo.cpp lib/CodeGen/CGDebugInfo.h test/CodeGen/2010-02-18-Dbg-VectorType.c

Devang Patel dpatel at apple.com
Tue Feb 23 14:59:39 PST 2010


Author: dpatel
Date: Tue Feb 23 16:59:39 2010
New Revision: 96999

URL: http://llvm.org/viewvc/llvm-project?rev=96999&view=rev
Log:
Emit debug info for VectorType.

Added:
    cfe/trunk/test/CodeGen/2010-02-18-Dbg-VectorType.c
Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
    cfe/trunk/lib/CodeGen/CGDebugInfo.h

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=96999&r1=96998&r2=96999&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Feb 23 16:59:39 2010
@@ -1034,6 +1034,28 @@
   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 @@
 
   // 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:

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=96999&r1=96998&r2=96999&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Tue Feb 23 16:59:39 2010
@@ -84,6 +84,7 @@
   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);

Added: cfe/trunk/test/CodeGen/2010-02-18-Dbg-VectorType.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/2010-02-18-Dbg-VectorType.c?rev=96999&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/2010-02-18-Dbg-VectorType.c (added)
+++ cfe/trunk/test/CodeGen/2010-02-18-Dbg-VectorType.c Tue Feb 23 16:59:39 2010
@@ -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;
+}
+





More information about the cfe-commits mailing list