2017-09-12 00:59:45 +02:00
; RUN: llc -filetype=obj -o - %s | llvm-dwarfdump -debug-loc - | FileCheck %s
[dwarfdump] Pretty print location expressions and location lists
Summary:
Based on Fred's patch here: https://reviews.llvm.org/D6771
I can't seem to commandeer the old review, so I'm creating a new one.
With that change the locations exrpessions are pretty printed inline in the
DIE tree. The output looks like this for debug_loc entries:
DW_AT_location [DW_FORM_data4] (0x00000000
0x0000000000000001 - 0x000000000000000b: DW_OP_consts +3
0x000000000000000b - 0x0000000000000012: DW_OP_consts +7
0x0000000000000012 - 0x000000000000001b: DW_OP_reg0 RAX, DW_OP_piece 0x4
0x000000000000001b - 0x0000000000000024: DW_OP_breg5 RDI+0)
And like this for debug_loc.dwo entries:
DW_AT_location [DW_FORM_sec_offset] (0x00000000
Addr idx 2 (w/ length 190): DW_OP_consts +0, DW_OP_stack_value
Addr idx 3 (w/ length 23): DW_OP_reg0 RAX, DW_OP_piece 0x4)
Simple locations without ranges are printed inline:
DW_AT_location [DW_FORM_block1] (DW_OP_reg4 RSI, DW_OP_piece 0x4, DW_OP_bit_piece 0x20 0x0)
The debug_loc(.dwo) dumping in changed accordingly to factor the code.
Reviewers: dblaikie, aprantl, friss
Subscribers: mgorny, javed.absar, hiraditya, llvm-commits, JDevlieghere
Differential Revision: https://reviews.llvm.org/D37123
llvm-svn: 312042
2017-08-29 23:41:21 +02:00
2017-04-25 21:40:53 +02:00
; Note that it would be even better to avoid emitting the empty piece.
[dwarfdump] Pretty print location expressions and location lists
Summary:
Based on Fred's patch here: https://reviews.llvm.org/D6771
I can't seem to commandeer the old review, so I'm creating a new one.
With that change the locations exrpessions are pretty printed inline in the
DIE tree. The output looks like this for debug_loc entries:
DW_AT_location [DW_FORM_data4] (0x00000000
0x0000000000000001 - 0x000000000000000b: DW_OP_consts +3
0x000000000000000b - 0x0000000000000012: DW_OP_consts +7
0x0000000000000012 - 0x000000000000001b: DW_OP_reg0 RAX, DW_OP_piece 0x4
0x000000000000001b - 0x0000000000000024: DW_OP_breg5 RDI+0)
And like this for debug_loc.dwo entries:
DW_AT_location [DW_FORM_sec_offset] (0x00000000
Addr idx 2 (w/ length 190): DW_OP_consts +0, DW_OP_stack_value
Addr idx 3 (w/ length 23): DW_OP_reg0 RAX, DW_OP_piece 0x4)
Simple locations without ranges are printed inline:
DW_AT_location [DW_FORM_block1] (DW_OP_reg4 RSI, DW_OP_piece 0x4, DW_OP_bit_piece 0x20 0x0)
The debug_loc(.dwo) dumping in changed accordingly to factor the code.
Reviewers: dblaikie, aprantl, friss
Subscribers: mgorny, javed.absar, hiraditya, llvm-commits, JDevlieghere
Differential Revision: https://reviews.llvm.org/D37123
llvm-svn: 312042
2017-08-29 23:41:21 +02:00
; CHECK: {{.*}}: DW_OP_piece 0x8{{$}}
2017-04-25 21:40:53 +02:00
source_filename = "bugpoint-reduced-simplified.ll"
target triple = "i386-apple-ios7.0.0"
%class.K = type { %class.N , %struct.F , i32 }
%class.N = type { %struct.B }
%struct.B = type { i8 }
%struct.F = type { i8 }
%struct.ConditionPlatformHelper = type { i8 }
%"struct.J<K::L, false, int>::Node" = type { %"class.K::L" }
%"class.K::L" = type { %class.__thread_id }
%class.__thread_id = type { i32 }
%"struct.K::M" = type { %class.I , %class.H }
%class.I = type { i32 }
%class.H = type { i32 }
; Function Attrs: nounwind
define void @_Z34swift_getGenericMetadata_argumentsv ( ) #0 !dbg !5 {
entry:
%ref.tmp = alloca %class.K , align 8
%0 = getelementptr inbounds %class.K , %class.K * %ref.tmp , i32 0 , i32 0 , i32 0 , i32 0
%call = tail call i64 @_Z8getCacheP23ConditionPlatformHelper ( %struct.ConditionPlatformHelper * undef )
%1 = bitcast %class.K * %ref.tmp to i64 *
%LastSearch.i.i = getelementptr inbounds %class.K , %class.K * %ref.tmp , i32 0 , i32 0 , i32 0
%call.i.i = call %"struct.J<K::L, false, int>::Node" * @_ZN1BIPN1JIN1K1LELb0EiE4NodeEE4loadEv ( %struct.B * nonnull %LastSearch.i.i )
%tobool.i.i = icmp eq %"struct.J<K::L, false, int>::Node" * %call.i.i , null
br i1 %tobool.i.i , label %_ZN1NIN1K1LELi0EE11getOrInsertIiEE1AIPS1_ET_.exit.i , label %if.then.i.i
if.then.i.i:
%2 = lshr i64 %call , 32
%3 = trunc i64 %2 to i32
%Payload.i.i = getelementptr inbounds %"struct.J<K::L, false, int>::Node" , %"struct.J<K::L, false, int>::Node" * %call.i.i , i32 0 , i32 0
br label %_ZN1NIN1K1LELi0EE11getOrInsertIiEE1AIPS1_ET_.exit.i
_ZN1NIN1K1LELi0EE11getOrInsertIiEE1AIPS1_ET_.exit.i: ; preds = %if.then.i.i, %entry
%retval.sroa.0.0.i.i = phi %"class.K::L" * [ %Payload.i.i , %if.then.i.i ] , [ undef , %entry ]
%call4.i = call %"struct.K::M" * @_ZN1FIN1K1MEE3getEv ( %struct.F * undef )
2017-07-28 22:21:02 +02:00
call void @llvm.dbg.value ( metadata %"struct.K::M" * %call4.i , metadata !7 , metadata !11 ) , !dbg !12
call void @llvm.dbg.value ( metadata %"struct.K::M" * %call4.i , metadata !7 , metadata !18 ) , !dbg !12
2017-04-25 21:40:53 +02:00
%Handle2.i.i.i.i.i = getelementptr inbounds %"struct.K::M" , %"struct.K::M" * %call4.i , i32 0 , i32 0 , i32 0
%Handle.i.i.i.i.i = getelementptr inbounds %"struct.K::M" , %"struct.K::M" * %call4.i , i32 0 , i32 1 , i32 0
%4 = getelementptr inbounds %"class.K::L" , %"class.K::L" * %retval.sroa.0.0.i.i , i32 0 , i32 0 , i32 0
br label %while.body.i.i.i.i
while.body.i.i.i.i:
%5 = load i32 , i32 * %4 , align 4
%call.i.i.i.i.i.i = call i32 @_Z6get_idv ( ) , !dbg !12
%call.i.i.i.i.i.i.i = call zeroext i1 @_Z24__libcpp_thread_id_equalii ( i32 %5 , i32 %call.i.i.i.i.i.i )
%6 = load i32 , i32 * %Handle2.i.i.i.i.i , align 4
call void @_ZN23ConditionPlatformHelper4waitERii ( i32 * nonnull dereferenceable ( 4 ) %Handle.i.i.i.i.i , i32 %6 )
br label %while.body.i.i.i.i
}
declare i64 @_Z8getCacheP23ConditionPlatformHelper ( %struct.ConditionPlatformHelper * ) local_unnamed_addr
declare %"struct.K::M" * @_ZN1FIN1K1MEE3getEv ( %struct.F * ) local_unnamed_addr
declare %"struct.J<K::L, false, int>::Node" * @_ZN1BIPN1JIN1K1LELb0EiE4NodeEE4loadEv ( %struct.B * ) local_unnamed_addr
declare i32 @_Z6get_idv ( ) local_unnamed_addr
declare zeroext i1 @_Z24__libcpp_thread_id_equalii ( i32 , i32 ) local_unnamed_addr
declare void @_ZN23ConditionPlatformHelper4waitERii ( i32 * dereferenceable ( 4 ) , i32 ) local_unnamed_addr
; Function Attrs: nounwind readnone
2017-07-28 22:21:02 +02:00
declare void @llvm.dbg.value ( metadata , metadata , metadata ) #1
2017-04-25 21:40:53 +02:00
2019-12-25 01:02:47 +01:00
attributes #0 = { nounwind "frame-pointer" = "non-leaf" }
2017-04-25 21:40:53 +02:00
attributes #1 = { nounwind readnone }
!llvm.dbg.cu = ! { !0 }
!llvm.module.flags = ! { !3 , !4 }
!0 = distinct !DICompileUnit ( language: D W _ L A N G _ C _ p l u s _ p l u s , file: !1 , isOptimized: true , runtimeVersion: 0 , emissionKind: F u l l D e b u g , enums: !2 )
!1 = !DIFile ( filename: "test.ii" , directory: "/" )
!2 = ! { }
!3 = ! { i32 2 , !"Dwarf Version" , i32 2 }
!4 = ! { i32 2 , !"Debug Info Version" , i32 3 }
[DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label.
In order to set breakpoints on labels and list source code around
labels, we need collect debug information for labels, i.e., label
name, the function label belong, line number in the file, and the
address label located. In order to keep these information in LLVM
IR and to allow backend to generate debug information correctly.
We create a new kind of metadata for labels, DILabel. The format
of DILabel is
!DILabel(scope: !1, name: "foo", file: !2, line: 3)
We hope to keep debug information as much as possible even the
code is optimized. So, we create a new kind of intrinsic for label
metadata to avoid the metadata is eliminated with basic block.
The intrinsic will keep existing if we keep it from optimized out.
The format of the intrinsic is
llvm.dbg.label(metadata !1)
It has only one argument, that is the DILabel metadata. The
intrinsic will follow the label immediately. Backend could get the
label metadata through the intrinsic's parameter.
We also create DIBuilder API for labels to be used by Frontend.
Frontend could use createLabel() to allocate DILabel objects, and use
insertLabel() to insert llvm.dbg.label intrinsic in LLVM IR.
Differential Revision: https://reviews.llvm.org/D45024
Patch by Hsiangkai Wang.
llvm-svn: 331841
2018-05-09 04:40:45 +02:00
!5 = distinct !DISubprogram ( name: "swift_getGenericMetadata_arguments" , linkageName: "_Z34swift_getGenericMetadata_argumentsv" , scope: !0 , file: !1 , line: 95 , type: !6 , isLocal: false , isDefinition: true , scopeLine: 95 , flags: D I F l a g P r o t o t y p e d , isOptimized: true , unit: !0 , retainedNodes: !2 )
2017-04-25 21:40:53 +02:00
!6 = !DISubroutineType ( types: !2 )
!7 = !DILocalVariable ( name: "criticalSection" , arg: 2 , scope: !8 , file: !1 , line: 23 , type: !10 )
[DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label.
In order to set breakpoints on labels and list source code around
labels, we need collect debug information for labels, i.e., label
name, the function label belong, line number in the file, and the
address label located. In order to keep these information in LLVM
IR and to allow backend to generate debug information correctly.
We create a new kind of metadata for labels, DILabel. The format
of DILabel is
!DILabel(scope: !1, name: "foo", file: !2, line: 3)
We hope to keep debug information as much as possible even the
code is optimized. So, we create a new kind of intrinsic for label
metadata to avoid the metadata is eliminated with basic block.
The intrinsic will keep existing if we keep it from optimized out.
The format of the intrinsic is
llvm.dbg.label(metadata !1)
It has only one argument, that is the DILabel metadata. The
intrinsic will follow the label immediately. Backend could get the
label metadata through the intrinsic's parameter.
We also create DIBuilder API for labels to be used by Frontend.
Frontend could use createLabel() to allocate DILabel objects, and use
insertLabel() to insert llvm.dbg.label intrinsic in LLVM IR.
Differential Revision: https://reviews.llvm.org/D45024
Patch by Hsiangkai Wang.
llvm-svn: 331841
2018-05-09 04:40:45 +02:00
!8 = distinct !DISubprogram ( name: "<(lambda at test.ii:28:14)>" , scope: !0 , file: !1 , line: 23 , type: !6 , isLocal: false , isDefinition: true , scopeLine: 23 , flags: D I F l a g P r o t o t y p e d , isOptimized: true , unit: !0 , templateParams: !2 , declaration: !9 , retainedNodes: !2 )
2017-04-25 21:40:53 +02:00
!9 = !DISubprogram ( name: "<(lambda at test.ii:28:14)>" , scope: !0 , file: !1 , line: 23 , type: !6 , isLocal: false , isDefinition: false , scopeLine: 23 , flags: D I F l a g P u b l i c | D I F l a g P r o t o t y p e d , isOptimized: true , templateParams: !2 )
!10 = distinct !DICompositeType ( tag: D W _ T A G _ c l a s s _ type , scope: !0 , file: !1 , line: 28 , size: 96 , elements: !2 )
!11 = !DIExpression ( D W _ O P _ s t a c k _ v a l u e , D W _ O P _ L L V M _ f r a g m e n t , 0 , 32 )
!12 = !DILocation ( line: 23 , column: 33 , scope: !8 , inlinedAt: !13 )
!13 = distinct !DILocation ( line: 28 , column: 5 , scope: !14 , inlinedAt: !16 )
[DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label.
In order to set breakpoints on labels and list source code around
labels, we need collect debug information for labels, i.e., label
name, the function label belong, line number in the file, and the
address label located. In order to keep these information in LLVM
IR and to allow backend to generate debug information correctly.
We create a new kind of metadata for labels, DILabel. The format
of DILabel is
!DILabel(scope: !1, name: "foo", file: !2, line: 3)
We hope to keep debug information as much as possible even the
code is optimized. So, we create a new kind of intrinsic for label
metadata to avoid the metadata is eliminated with basic block.
The intrinsic will keep existing if we keep it from optimized out.
The format of the intrinsic is
llvm.dbg.label(metadata !1)
It has only one argument, that is the DILabel metadata. The
intrinsic will follow the label immediately. Backend could get the
label metadata through the intrinsic's parameter.
We also create DIBuilder API for labels to be used by Frontend.
Frontend could use createLabel() to allocate DILabel objects, and use
insertLabel() to insert llvm.dbg.label intrinsic in LLVM IR.
Differential Revision: https://reviews.llvm.org/D45024
Patch by Hsiangkai Wang.
llvm-svn: 331841
2018-05-09 04:40:45 +02:00
!14 = distinct !DISubprogram ( name: "<(lambda at test.ii:87:58)>" , scope: !0 , file: !1 , line: 27 , type: !6 , isLocal: false , isDefinition: true , scopeLine: 27 , flags: D I F l a g P r o t o t y p e d , isOptimized: true , unit: !0 , templateParams: !2 , declaration: !15 , retainedNodes: !2 )
2017-04-25 21:40:53 +02:00
!15 = !DISubprogram ( name: "<(lambda at test.ii:87:58)>" , scope: !0 , file: !1 , line: 27 , type: !6 , isLocal: false , isDefinition: false , scopeLine: 27 , flags: D I F l a g P u b l i c | D I F l a g P r o t o t y p e d , isOptimized: true , templateParams: !2 )
!16 = distinct !DILocation ( line: 99 , column: 21 , scope: !17 )
!17 = !DILexicalBlockFile ( scope: !5 , file: !1 , discriminator: 2 )
2017-06-14 15:14:38 +02:00
!18 = !DIExpression ( D W _ O P _ p l u s _ u c o n s t , 4 , D W _ O P _ s t a c k _ v a l u e , D W _ O P _ L L V M _ f r a g m e n t , 64 , 32 )