[llvm] r202332 - Add a debug info code generation level to the compile unit metadata

David Blaikie dblaikie at gmail.com
Wed Feb 26 22:54:21 PST 2014


On Wed, Feb 26, 2014 at 5:24 PM, Eric Christopher <echristo at gmail.com> wrote:
> Author: echristo
> Date: Wed Feb 26 19:24:56 2014
> New Revision: 202332
>
> URL: http://llvm.org/viewvc/llvm-project?rev=202332&view=rev
> Log:
> Add a debug info code generation level to the compile unit metadata
> and update everything accordingly. This can be used to conditionalize
> the amount of output in the backend based on the amount of debug
> requested/metadata emission scheme by a front end (e.g. clang).

Just to reiterate a conversation Eric & I had offline - we're not sure
why changing the DICompileUnit schema didn't cause more (read: all)
debug info tests to fail.

Manman - if I understood correctly, your verifier changes last year
caused the debug info verifier to run implicitly when llc is run over
an IR file right? so generally our IR debug info tests should all be
being verified on every execution? Is this just a hole in the verifier
that we aren't verifying the compile units?

>
> Paired with a commit to clang.
>
> Modified:
>     llvm/trunk/include/llvm/DIBuilder.h
>     llvm/trunk/include/llvm/DebugInfo.h
>     llvm/trunk/lib/IR/DIBuilder.cpp
>     llvm/trunk/lib/IR/DebugInfo.cpp
>     llvm/trunk/test/DebugInfo/2010-03-19-DbgDeclare.ll
>     llvm/trunk/test/Transforms/StripSymbols/2010-08-25-crash.ll
>     llvm/trunk/test/Transforms/StripSymbols/strip-dead-debug-info.ll
>
> Modified: llvm/trunk/include/llvm/DIBuilder.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DIBuilder.h?rev=202332&r1=202331&r2=202332&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/DIBuilder.h (original)
> +++ llvm/trunk/include/llvm/DIBuilder.h Wed Feb 26 19:24:56 2014
> @@ -87,6 +87,7 @@ namespace llvm {
>      public:
>      explicit DIBuilder(Module &M);
>      enum ComplexAddrKind { OpPlus=1, OpDeref };
> +    enum DebugEmissionKind { FullDebug=1, LineTablesOnly };
>
>      /// finalize - Construct any deferred debug info descriptors.
>      void finalize();
> @@ -111,7 +112,8 @@ namespace llvm {
>                                      StringRef Dir, StringRef Producer,
>                                      bool isOptimized, StringRef Flags,
>                                      unsigned RV,
> -                                    StringRef SplitName = StringRef());
> +                                    StringRef SplitName = StringRef(),
> +                                    DebugEmissionKind Kind = FullDebug);
>
>      /// createFile - Create a file descriptor to hold debugging information
>      /// for a file.
>
> Modified: llvm/trunk/include/llvm/DebugInfo.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo.h?rev=202332&r1=202331&r2=202332&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo.h Wed Feb 26 19:24:56 2014
> @@ -427,6 +427,7 @@ public:
>    DIArray getImportedEntities() const;
>
>    StringRef getSplitDebugFilename() const { return getStringField(12); }
> +  unsigned getEmissionKind() const { return getUnsignedField(13); }
>
>    /// Verify - Verify that a compile unit is well formed.
>    bool Verify() const;
>
> Modified: llvm/trunk/lib/IR/DIBuilder.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DIBuilder.cpp?rev=202332&r1=202331&r2=202332&view=diff
> ==============================================================================
> --- llvm/trunk/lib/IR/DIBuilder.cpp (original)
> +++ llvm/trunk/lib/IR/DIBuilder.cpp Wed Feb 26 19:24:56 2014
> @@ -97,7 +97,9 @@ DICompileUnit DIBuilder::createCompileUn
>                                             StringRef Directory,
>                                             StringRef Producer, bool isOptimized,
>                                             StringRef Flags, unsigned RunTimeVer,
> -                                           StringRef SplitName) {
> +                                           StringRef SplitName,
> +                                           DebugEmissionKind Kind) {
> +
>    assert(((Lang <= dwarf::DW_LANG_Python && Lang >= dwarf::DW_LANG_C89) ||
>            (Lang <= dwarf::DW_LANG_hi_user && Lang >= dwarf::DW_LANG_lo_user)) &&
>           "Invalid Language tag");
> @@ -127,7 +129,8 @@ DICompileUnit DIBuilder::createCompileUn
>      TempSubprograms,
>      TempGVs,
>      TempImportedModules,
> -    MDString::get(VMContext, SplitName)
> +    MDString::get(VMContext, SplitName),
> +    ConstantInt::get(Type::getInt32Ty(VMContext), Kind)
>    };
>
>    MDNode *CUNode = MDNode::get(VMContext, Elts);
>
> Modified: llvm/trunk/lib/IR/DebugInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=202332&r1=202331&r2=202332&view=diff
> ==============================================================================
> --- llvm/trunk/lib/IR/DebugInfo.cpp (original)
> +++ llvm/trunk/lib/IR/DebugInfo.cpp Wed Feb 26 19:24:56 2014
> @@ -382,7 +382,7 @@ bool DICompileUnit::Verify() const {
>    if (getFilename().empty())
>      return false;
>
> -  return DbgNode->getNumOperands() == 13;
> +  return DbgNode->getNumOperands() == 14;
>  }
>
>  /// Verify - Verify that an ObjC property is well formed.
>
> Modified: llvm/trunk/test/DebugInfo/2010-03-19-DbgDeclare.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/2010-03-19-DbgDeclare.ll?rev=202332&r1=202331&r2=202332&view=diff
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/2010-03-19-DbgDeclare.ll (original)
> +++ llvm/trunk/test/DebugInfo/2010-03-19-DbgDeclare.ll Wed Feb 26 19:24:56 2014
> @@ -9,7 +9,7 @@ entry:
>  }
>  !llvm.dbg.cu = !{!2}
>  !llvm.module.flags = !{!5}
> -!2 = metadata !{i32 786449, metadata !4, i32 32769, metadata !"clang version 3.3 ", i1 false, metadata !"", i32 0, metadata !3, metadata !3, metadata !3, metadata !3,  metadata !3, metadata !""} ; [ DW_TAG_compile_unit ] [/usr/local/google/home/blaikie/dev/scratch/scratch.cpp] [lang 0x8001]
> +!2 = metadata !{i32 786449, metadata !4, i32 32769, metadata !"clang version 3.3 ", i1 false, metadata !"", i32 0, metadata !3, metadata !3, metadata !3, metadata !3,  metadata !3, metadata !"", i32 1} ; [ DW_TAG_compile_unit ] [/usr/local/google/home/blaikie/dev/scratch/scratch.cpp] [lang 0x8001]
>  !3 = metadata !{}
>  !0 = metadata !{i32 662302, i32 26, metadata !1, null}
>  !1 = metadata !{i32 4, metadata !"foo"}
>
> Modified: llvm/trunk/test/Transforms/StripSymbols/2010-08-25-crash.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/StripSymbols/2010-08-25-crash.ll?rev=202332&r1=202331&r2=202332&view=diff
> ==============================================================================
> --- llvm/trunk/test/Transforms/StripSymbols/2010-08-25-crash.ll (original)
> +++ llvm/trunk/test/Transforms/StripSymbols/2010-08-25-crash.ll Wed Feb 26 19:24:56 2014
> @@ -9,7 +9,7 @@ entry:
>
>  !0 = metadata !{i32 524334, metadata !10, metadata !1, metadata !"foo", metadata !"foo", metadata !"foo", i32 3, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 ()* @foo, null, null, null, i32 0} ; [ DW_TAG_subprogram ]
>  !1 = metadata !{i32 524329, metadata !10} ; [ DW_TAG_file_type ]
> -!2 = metadata !{i32 524305, metadata !10, i32 12, metadata !"clang version 2.8 (trunk 112062)", i1 true, metadata !"", i32 0, metadata !11, metadata !11, metadata !12, metadata !13, null, metadata !""} ; [ DW_TAG_compile_unit ]
> +!2 = metadata !{i32 524305, metadata !10, i32 12, metadata !"clang version 2.8 (trunk 112062)", i1 true, metadata !"", i32 0, metadata !11, metadata !11, metadata !12, metadata !13, null, metadata !"", i32 1} ; [ DW_TAG_compile_unit ]
>  !3 = metadata !{i32 524309, metadata !10, metadata !1, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !4, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
>  !4 = metadata !{metadata !5}
>  !5 = metadata !{i32 524324, metadata !10, metadata !1, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
>
> Modified: llvm/trunk/test/Transforms/StripSymbols/strip-dead-debug-info.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/StripSymbols/strip-dead-debug-info.ll?rev=202332&r1=202331&r2=202332&view=diff
> ==============================================================================
> --- llvm/trunk/test/Transforms/StripSymbols/strip-dead-debug-info.ll (original)
> +++ llvm/trunk/test/Transforms/StripSymbols/strip-dead-debug-info.ll Wed Feb 26 19:24:56 2014
> @@ -30,7 +30,7 @@ attributes #2 = { nounwind readonly ssp
>  !llvm.dbg.cu = !{!0}
>  !llvm.module.flags = !{!25}
>
> -!0 = metadata !{i32 524305, metadata !1, i32 1, metadata !"4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", i1 true, metadata !"", i32 0, metadata !2, metadata !2, metadata !23, metadata !24, null, metadata !""} ; [ DW_TAG_compile_unit ] [/tmp//g.c] [DW_LANG_C89]
> +!0 = metadata !{i32 524305, metadata !1, i32 1, metadata !"4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", i1 true, metadata !"", i32 0, metadata !2, metadata !2, metadata !23, metadata !24, null, metadata !"", i32 1} ; [ DW_TAG_compile_unit ] [/tmp//g.c] [DW_LANG_C89]
>  !1 = metadata !{metadata !"g.c", metadata !"/tmp/"}
>  !2 = metadata !{null}
>  !3 = metadata !{i32 524334, metadata !1, null, metadata !"bar", metadata !"bar", metadata !"", i32 5, metadata !4, i1 true, i1 true, i32 0, i32 0, null, i1 false, i1 true, null, null, null, null, i32 0} ; [ DW_TAG_subprogram ] [line 5] [local] [def] [scope 0] [bar]
>
>
> _______________________________________________
> 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