From: Eric Christopher Date: Tue, 8 Jan 2013 01:53:52 +0000 (+0000) Subject: Remove the llvm-local DW_TAG_vector_type tag and add a test to X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=9a1e0e252a7ede548acaac98cf304d4bb135fb97;p=oota-llvm.git Remove the llvm-local DW_TAG_vector_type tag and add a test to make sure that vector types do work. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171833 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/docs/SourceLevelDebugging.rst b/docs/SourceLevelDebugging.rst index 933534fb499..781824c01f0 100644 --- a/docs/SourceLevelDebugging.rst +++ b/docs/SourceLevelDebugging.rst @@ -484,14 +484,13 @@ are possible tag values: DW_TAG_enumeration_type = 4 DW_TAG_structure_type = 19 DW_TAG_union_type = 23 - DW_TAG_vector_type = 259 DW_TAG_subroutine_type = 21 DW_TAG_inheritance = 28 The vector flag indicates that an array type is a native packed vector. -The members of array types (tag = ``DW_TAG_array_type``) or vector types (tag = -``DW_TAG_vector_type``) are :ref:`subrange descriptors `, each +The members of array types (tag = ``DW_TAG_array_type``) are +:ref:`subrange descriptors `, each representing the range of subscripts at that level of indexing. The members of enumeration types (tag = ``DW_TAG_enumeration_type``) are diff --git a/include/llvm/DebugInfo.h b/include/llvm/DebugInfo.h index 3b17dc115c3..cc1c6a0a576 100644 --- a/include/llvm/DebugInfo.h +++ b/include/llvm/DebugInfo.h @@ -61,7 +61,8 @@ namespace llvm { FlagExplicit = 1 << 7, FlagPrototyped = 1 << 8, FlagObjcClassComplete = 1 << 9, - FlagObjectPointer = 1 << 10 + FlagObjectPointer = 1 << 10, + FlagVector = 1 << 11 }; protected: const MDNode *DbgNode; @@ -296,6 +297,9 @@ namespace llvm { bool isObjcClassComplete() const { return (getFlags() & FlagObjcClassComplete) != 0; } + bool isVector() const { + return (getFlags() & FlagVector) != 0; + } bool isValid() const { return DbgNode && (isBasicType() || isDerivedType() || isCompositeType()); } diff --git a/include/llvm/Support/Dwarf.h b/include/llvm/Support/Dwarf.h index 22c181e4ce6..c703da5762f 100644 --- a/include/llvm/Support/Dwarf.h +++ b/include/llvm/Support/Dwarf.h @@ -50,8 +50,6 @@ enum llvm_dwarf_constants { DW_TAG_auto_variable = 0x100, // Tag for local (auto) variables. DW_TAG_arg_variable = 0x101, // Tag for argument variables. - // 0x102 - Unused. - DW_TAG_vector_type = 0x103, // Tag for vector types. DW_TAG_user_base = 0x1000, // Recommended base for user tags. diff --git a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index 372f98da3d9..21cceaf7c3c 100644 --- a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -825,7 +825,6 @@ void CompileUnit::constructTypeDIE(DIE &Buffer, DICompositeType CTy) { Buffer.setTag(Tag); switch (Tag) { - case dwarf::DW_TAG_vector_type: case dwarf::DW_TAG_array_type: constructArrayTypeDIE(Buffer, &CTy); break; @@ -1347,7 +1346,7 @@ void CompileUnit::constructSubrangeDIE(DIE &Buffer, DISubrange SR, void CompileUnit::constructArrayTypeDIE(DIE &Buffer, DICompositeType *CTy) { Buffer.setTag(dwarf::DW_TAG_array_type); - if (CTy->getTag() == dwarf::DW_TAG_vector_type) + if (CTy->isVector()) addFlag(&Buffer, dwarf::DW_AT_GNU_vector); // Emit derived type. diff --git a/lib/IR/DIBuilder.cpp b/lib/IR/DIBuilder.cpp index f9e5cab1471..bd7f0e3ffb9 100644 --- a/lib/IR/DIBuilder.cpp +++ b/lib/IR/DIBuilder.cpp @@ -616,9 +616,10 @@ DIType DIBuilder::createArrayType(uint64_t Size, uint64_t AlignInBits, /// createVectorType - Create debugging information entry for a vector. DIType DIBuilder::createVectorType(uint64_t Size, uint64_t AlignInBits, DIType Ty, DIArray Subscripts) { - // TAG_vector_type is encoded in DICompositeType format. + + // A vector is an array type with the FlagVector flag applied. Value *Elts[] = { - GetTagConstant(VMContext, dwarf::DW_TAG_vector_type), + GetTagConstant(VMContext, dwarf::DW_TAG_array_type), NULL, //TheCU, MDString::get(VMContext, ""), NULL, //TheCU, @@ -626,7 +627,7 @@ DIType DIBuilder::createVectorType(uint64_t Size, uint64_t AlignInBits, ConstantInt::get(Type::getInt64Ty(VMContext), Size), ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits), ConstantInt::get(Type::getInt32Ty(VMContext), 0), - ConstantInt::get(Type::getInt32Ty(VMContext), 0), + ConstantInt::get(Type::getInt32Ty(VMContext), DIType::FlagVector), Ty, Subscripts, ConstantInt::get(Type::getInt32Ty(VMContext), 0), diff --git a/lib/IR/DebugInfo.cpp b/lib/IR/DebugInfo.cpp index d2883080977..7083495c72f 100644 --- a/lib/IR/DebugInfo.cpp +++ b/lib/IR/DebugInfo.cpp @@ -197,7 +197,6 @@ bool DIDescriptor::isCompositeType() const { case dwarf::DW_TAG_structure_type: case dwarf::DW_TAG_union_type: case dwarf::DW_TAG_enumeration_type: - case dwarf::DW_TAG_vector_type: case dwarf::DW_TAG_subroutine_type: case dwarf::DW_TAG_class_type: return true; @@ -426,7 +425,7 @@ bool DIType::Verify() const { Tag != dwarf::DW_TAG_ptr_to_member_type && Tag != dwarf::DW_TAG_reference_type && Tag != dwarf::DW_TAG_rvalue_reference_type && - Tag != dwarf::DW_TAG_restrict_type && Tag != dwarf::DW_TAG_vector_type && + Tag != dwarf::DW_TAG_restrict_type && Tag != dwarf::DW_TAG_array_type && Tag != dwarf::DW_TAG_enumeration_type && Tag != dwarf::DW_TAG_subroutine_type && @@ -1100,6 +1099,8 @@ void DIType::printInternal(raw_ostream &OS) const { if (isForwardDecl()) OS << " [fwd]"; + if (isVector()) + OS << " [vector]"; } void DIDerivedType::printInternal(raw_ostream &OS) const { diff --git a/lib/Support/Dwarf.cpp b/lib/Support/Dwarf.cpp index 8a96048bb73..615efb8b0e8 100644 --- a/lib/Support/Dwarf.cpp +++ b/lib/Support/Dwarf.cpp @@ -80,7 +80,6 @@ const char *llvm::dwarf::TagString(unsigned Tag) { case DW_TAG_hi_user: return "DW_TAG_hi_user"; case DW_TAG_auto_variable: return "DW_TAG_auto_variable"; case DW_TAG_arg_variable: return "DW_TAG_arg_variable"; - case DW_TAG_vector_type: return "DW_TAG_vector_type"; case DW_TAG_rvalue_reference_type: return "DW_TAG_rvalue_reference_type"; case DW_TAG_template_alias: return "DW_TAG_template_alias"; case DW_TAG_MIPS_loop: return "DW_TAG_MIPS_loop"; diff --git a/test/DebugInfo/X86/vector.ll b/test/DebugInfo/X86/vector.ll new file mode 100644 index 00000000000..5f46406ed1b --- /dev/null +++ b/test/DebugInfo/X86/vector.ll @@ -0,0 +1,23 @@ +; RUN: llc -mtriple=x86_64-linux-gnu -O0 -filetype=obj -o %t %s +; RUN: llvm-dwarfdump %t | FileCheck %s + +@a = common global <4 x i32> zeroinitializer, align 16 + +!llvm.dbg.cu = !{!0} + +!0 = metadata !{i32 786449, i32 0, i32 12, metadata !"foo.c", metadata !"/Users/echristo", metadata !"clang version 3.3 (trunk 171825) (llvm/trunk 171822)", i1 true, i1 false, metadata !"", i32 0, metadata !1, metadata !1, metadata !1, metadata !3} ; [ DW_TAG_compile_unit ] [/Users/echristo/foo.c] [DW_LANG_C99] +!1 = metadata !{metadata !2} +!2 = metadata !{i32 0} +!3 = metadata !{metadata !4} +!4 = metadata !{metadata !5} +!5 = metadata !{i32 786484, i32 0, null, metadata !"a", metadata !"a", metadata !"", metadata !6, i32 3, metadata !7, i32 0, i32 1, <4 x i32>* @a} ; [ DW_TAG_variable ] [a] [line 3] [def] +!6 = metadata !{i32 786473, metadata !"foo.c", metadata !"/Users/echristo", null} ; [ DW_TAG_file_type ] +!7 = metadata !{i32 786454, null, metadata !"v4si", metadata !6, i32 1, i64 0, i64 0, i64 0, i32 0, metadata !8} ; [ DW_TAG_typedef ] [v4si] [line 1, size 0, align 0, offset 0] [from ] +!8 = metadata !{i32 786433, null, metadata !"", null, i32 0, i64 128, i64 128, i32 0, i32 2048, metadata !9, metadata !10, i32 0, i32 0} ; [ DW_TAG_array_type ] [line 0, size 128, align 128, offset 0] [vector] [from int] +!9 = metadata !{i32 786468, null, metadata !"int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed] +!10 = metadata !{metadata !11} +!11 = metadata !{i32 786465, i64 0, i64 4} ; [ DW_TAG_subrange_type ] [0, 3] + +; Check that we get an array type with a vector attribute. +; CHECK: DW_TAG_array_type +; CHECK-NEXT: DW_AT_GNU_vector