[llvm-commits] [llvm] r171833 - in /llvm/trunk: docs/SourceLevelDebugging.rst include/llvm/DebugInfo.h include/llvm/Support/Dwarf.h lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp lib/IR/DIBuilder.cpp lib/IR/DebugInfo.cpp lib/Support/Dwarf.cpp test/DebugInfo/X86/vector.ll

David Blaikie dblaikie at gmail.com
Mon Jan 7 18:33:31 PST 2013


On Mon, Jan 7, 2013 at 5:53 PM, Eric Christopher <echristo at gmail.com> wrote:
> Author: echristo
> Date: Mon Jan  7 19:53:52 2013
> New Revision: 171833
>
> URL: http://llvm.org/viewvc/llvm-project?rev=171833&view=rev
> Log:
> Remove the llvm-local DW_TAG_vector_type tag and add a test to
> make sure that vector types do work.
>
> Added:
>     llvm/trunk/test/DebugInfo/X86/vector.ll
> Modified:
>     llvm/trunk/docs/SourceLevelDebugging.rst
>     llvm/trunk/include/llvm/DebugInfo.h
>     llvm/trunk/include/llvm/Support/Dwarf.h
>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
>     llvm/trunk/lib/IR/DIBuilder.cpp
>     llvm/trunk/lib/IR/DebugInfo.cpp
>     llvm/trunk/lib/Support/Dwarf.cpp
>
> Modified: llvm/trunk/docs/SourceLevelDebugging.rst
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/SourceLevelDebugging.rst?rev=171833&r1=171832&r2=171833&view=diff
> ==============================================================================
> --- llvm/trunk/docs/SourceLevelDebugging.rst (original)
> +++ llvm/trunk/docs/SourceLevelDebugging.rst Mon Jan  7 19:53:52 2013
> @@ -484,14 +484,13 @@
>    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 <format_subrange>`, each
> +The members of array types (tag = ``DW_TAG_array_type``) are
> +:ref:`subrange descriptors <format_subrange>`, each
>  representing the range of subscripts at that level of indexing.
>
>  The members of enumeration types (tag = ``DW_TAG_enumeration_type``) are
>
> Modified: llvm/trunk/include/llvm/DebugInfo.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo.h?rev=171833&r1=171832&r2=171833&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo.h Mon Jan  7 19:53:52 2013
> @@ -61,7 +61,8 @@
>        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 @@
>      bool isObjcClassComplete() const {
>        return (getFlags() & FlagObjcClassComplete) != 0;
>      }
> +    bool isVector() const {
> +      return (getFlags() & FlagVector) != 0;
> +    }
>      bool isValid() const {
>        return DbgNode && (isBasicType() || isDerivedType() || isCompositeType());
>      }
>
> Modified: llvm/trunk/include/llvm/Support/Dwarf.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Dwarf.h?rev=171833&r1=171832&r2=171833&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Support/Dwarf.h (original)
> +++ llvm/trunk/include/llvm/Support/Dwarf.h Mon Jan  7 19:53:52 2013
> @@ -50,8 +50,6 @@
>
>    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.
>
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=171833&r1=171832&r2=171833&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Mon Jan  7 19:53:52 2013
> @@ -825,7 +825,6 @@
>    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::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.
>
> Modified: llvm/trunk/lib/IR/DIBuilder.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DIBuilder.cpp?rev=171833&r1=171832&r2=171833&view=diff
> ==============================================================================
> --- llvm/trunk/lib/IR/DIBuilder.cpp (original)
> +++ llvm/trunk/lib/IR/DIBuilder.cpp Mon Jan  7 19:53:52 2013
> @@ -616,9 +616,10 @@
>  /// 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 @@
>      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),
>
> Modified: llvm/trunk/lib/IR/DebugInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=171833&r1=171832&r2=171833&view=diff
> ==============================================================================
> --- llvm/trunk/lib/IR/DebugInfo.cpp (original)
> +++ llvm/trunk/lib/IR/DebugInfo.cpp Mon Jan  7 19:53:52 2013
> @@ -197,7 +197,6 @@
>    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 @@
>        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 @@
>
>    if (isForwardDecl())
>      OS << " [fwd]";
> +  if (isVector())
> +    OS << " [vector]";
>  }
>
>  void DIDerivedType::printInternal(raw_ostream &OS) const {
>
> Modified: llvm/trunk/lib/Support/Dwarf.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Dwarf.cpp?rev=171833&r1=171832&r2=171833&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Support/Dwarf.cpp (original)
> +++ llvm/trunk/lib/Support/Dwarf.cpp Mon Jan  7 19:53:52 2013
> @@ -80,7 +80,6 @@
>    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";
>
> Added: llvm/trunk/test/DebugInfo/X86/vector.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/vector.ll?rev=171833&view=auto
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/X86/vector.ll (added)
> +++ llvm/trunk/test/DebugInfo/X86/vector.ll Mon Jan  7 19:53:52 2013
> @@ -0,0 +1,23 @@
> +; RUN: llc -mtriple=x86_64-linux-gnu -O0 -filetype=obj -o %t %s
> +; RUN: llvm-dwarfdump %t | FileCheck %s

The source code/command that generated this case might be useful to
add to a comment here so it's easier to update in the future.

> +
> + at 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
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list