2017-09-12 07:05:20 +08:00
; RUN: llc -arm-global-merge -global-merge-group-by-use=false -filetype=obj < %s | llvm-dwarfdump -debug-info -v - | FileCheck %s
2011-03-24 07:34:19 +08:00
2016-12-22 08:45:21 +08:00
source_filename = "test/CodeGen/ARM/2011-01-19-MergedGlobalDbg.ll"
2011-01-20 08:02:16 +08:00
target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32"
target triple = "thumbv7-apple-darwin10"
2016-12-22 08:45:21 +08:00
@x1 = internal global i8 1 , align 1 , !dbg !0
@x2 = internal global i8 1 , align 1 , !dbg !4
@x3 = internal global i8 1 , align 1 , !dbg !6
@x4 = internal global i8 1 , align 1 , !dbg !8
@x5 = global i8 1 , align 1 , !dbg !10
2011-01-20 08:02:16 +08:00
2014-08-06 00:20:25 +08:00
; CHECK: DW_TAG_variable
; CHECK-NOT: DW_TAG
; CHECK: DW_AT_name {{.*}} "x1"
; CHECK-NOT: {{DW_TAG|NULL}}
[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-30 05:41:21 +08:00
; CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addr [[ADDR:0x[0-9a-fA-F]+]])
2014-08-06 00:20:25 +08:00
; CHECK: DW_TAG_variable
; CHECK-NOT: DW_TAG
; CHECK: DW_AT_name {{.*}} "x2"
; CHECK-NOT: {{DW_TAG|NULL}}
[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-30 05:41:21 +08:00
; CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addr [[ADDR]], DW_OP_plus_uconst 0x1)
2011-01-20 08:02:16 +08:00
2016-12-22 08:45:21 +08:00
; Function Attrs: nounwind optsize
define zeroext i8 @get1 ( i8 zeroext %a ) #0 !dbg !16 {
2011-01-20 08:02:16 +08:00
entry:
2017-07-29 04:21:02 +08:00
tail call void @llvm.dbg.value ( metadata i8 %a , metadata !20 , metadata !23 ) , !dbg !24
2016-12-22 08:45:21 +08:00
%0 = load i8 , i8 * @x1 , align 4 , !dbg !24
2017-07-29 04:21:02 +08:00
tail call void @llvm.dbg.value ( metadata i8 %0 , metadata !21 , metadata !23 ) , !dbg !24
2016-12-22 08:45:21 +08:00
store i8 %a , i8 * @x1 , align 4 , !dbg !24
ret i8 %0 , !dbg !25
2011-01-20 08:02:16 +08:00
}
2016-12-22 08:45:21 +08:00
; Function Attrs: nounwind readnone
2017-07-29 04:21:02 +08:00
declare void @llvm.dbg.value ( metadata , metadata , metadata ) #1
2011-01-20 08:02:16 +08:00
2016-12-22 08:45:21 +08:00
; Function Attrs: nounwind optsize
define zeroext i8 @get2 ( i8 zeroext %a ) #0 !dbg !26 {
2011-01-20 08:02:16 +08:00
entry:
2017-07-29 04:21:02 +08:00
tail call void @llvm.dbg.value ( metadata i8 %a , metadata !28 , metadata !23 ) , !dbg !31
2016-12-22 08:45:21 +08:00
%0 = load i8 , i8 * @x2 , align 4 , !dbg !31
2017-07-29 04:21:02 +08:00
tail call void @llvm.dbg.value ( metadata i8 %0 , metadata !29 , metadata !23 ) , !dbg !31
2016-12-22 08:45:21 +08:00
store i8 %a , i8 * @x2 , align 4 , !dbg !31
ret i8 %0 , !dbg !32
2011-01-20 08:02:16 +08:00
}
2016-12-22 08:45:21 +08:00
; Function Attrs: nounwind optsize
define zeroext i8 @get3 ( i8 zeroext %a ) #0 !dbg !33 {
2011-01-20 08:02:16 +08:00
entry:
2017-07-29 04:21:02 +08:00
tail call void @llvm.dbg.value ( metadata i8 %a , metadata !35 , metadata !23 ) , !dbg !38
2016-12-22 08:45:21 +08:00
%0 = load i8 , i8 * @x3 , align 4 , !dbg !38
2017-07-29 04:21:02 +08:00
tail call void @llvm.dbg.value ( metadata i8 %0 , metadata !36 , metadata !23 ) , !dbg !38
2016-12-22 08:45:21 +08:00
store i8 %a , i8 * @x3 , align 4 , !dbg !38
ret i8 %0 , !dbg !39
2011-01-20 08:02:16 +08:00
}
2016-12-22 08:45:21 +08:00
; Function Attrs: nounwind optsize
define zeroext i8 @get4 ( i8 zeroext %a ) #0 !dbg !40 {
2011-01-20 08:02:16 +08:00
entry:
2017-07-29 04:21:02 +08:00
tail call void @llvm.dbg.value ( metadata i8 %a , metadata !42 , metadata !23 ) , !dbg !45
2016-12-22 08:45:21 +08:00
%0 = load i8 , i8 * @x4 , align 4 , !dbg !45
2017-07-29 04:21:02 +08:00
tail call void @llvm.dbg.value ( metadata i8 %0 , metadata !43 , metadata !23 ) , !dbg !45
2016-12-22 08:45:21 +08:00
store i8 %a , i8 * @x4 , align 4 , !dbg !45
ret i8 %0 , !dbg !46
2011-01-20 08:02:16 +08:00
}
2016-12-22 08:45:21 +08:00
; Function Attrs: nounwind optsize
define zeroext i8 @get5 ( i8 zeroext %a ) #0 !dbg !47 {
2011-01-20 08:02:16 +08:00
entry:
2017-07-29 04:21:02 +08:00
tail call void @llvm.dbg.value ( metadata i8 %a , metadata !49 , metadata !23 ) , !dbg !52
2016-12-22 08:45:21 +08:00
%0 = load i8 , i8 * @x5 , align 4 , !dbg !52
2017-07-29 04:21:02 +08:00
tail call void @llvm.dbg.value ( metadata i8 %0 , metadata !50 , metadata !23 ) , !dbg !52
2016-12-22 08:45:21 +08:00
store i8 %a , i8 * @x5 , align 4 , !dbg !52
ret i8 %0 , !dbg !53
2011-01-20 08:02:16 +08:00
}
2016-12-22 08:45:21 +08:00
attributes #0 = { nounwind optsize }
attributes #1 = { nounwind readnone }
!llvm.dbg.cu = ! { !12 }
!llvm.module.flags = ! { !15 }
2017-08-31 02:06:51 +08:00
!0 = !DIGlobalVariableExpression ( var: !1 , expr: !DIExpression ( ) )
2016-12-22 08:45:21 +08:00
!1 = !DIGlobalVariable ( name: "x1" , scope: !2 , file: !2 , line: 3 , type: !3 , isLocal: true , isDefinition: true )
!2 = !DIFile ( filename: "foo.c" , directory: "/tmp/" )
!3 = !DIBasicType ( name: "_Bool" , size: 8 , align: 8 , encoding: D W _ A T E _ b o o l e a n )
2017-08-31 02:06:51 +08:00
!4 = !DIGlobalVariableExpression ( var: !5 , expr: !DIExpression ( ) )
2016-12-22 08:45:21 +08:00
!5 = !DIGlobalVariable ( name: "x2" , scope: !2 , file: !2 , line: 6 , type: !3 , isLocal: true , isDefinition: true )
2017-08-31 02:06:51 +08:00
!6 = !DIGlobalVariableExpression ( var: !7 , expr: !DIExpression ( ) )
2016-12-22 08:45:21 +08:00
!7 = !DIGlobalVariable ( name: "x3" , scope: !2 , file: !2 , line: 9 , type: !3 , isLocal: true , isDefinition: true )
2017-08-31 02:06:51 +08:00
!8 = !DIGlobalVariableExpression ( var: !9 , expr: !DIExpression ( ) )
2016-12-22 08:45:21 +08:00
!9 = !DIGlobalVariable ( name: "x4" , scope: !2 , file: !2 , line: 12 , type: !3 , isLocal: true , isDefinition: true )
2017-08-31 02:06:51 +08:00
!10 = !DIGlobalVariableExpression ( var: !11 , expr: !DIExpression ( ) )
2016-12-22 08:45:21 +08:00
!11 = !DIGlobalVariable ( name: "x5" , scope: !2 , file: !2 , line: 15 , type: !3 , isLocal: false , isDefinition: true )
!12 = distinct !DICompileUnit ( language: D W _ L A N G _ C 89 , file: !2 , producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2369.8)" , isOptimized: true , runtimeVersion: 0 , emissionKind: F u l l D e b u g , enums: !13 , retainedTypes: !13 , globals: !14 , imports: !13 )
!13 = ! { }
!14 = ! { !0 , !4 , !6 , !8 , !10 }
!15 = ! { i32 1 , !"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 10:40:45 +08:00
!16 = distinct !DISubprogram ( name: "get1" , linkageName: "get1" , scope: !2 , file: !2 , line: 4 , type: !17 , isLocal: false , isDefinition: true , scopeLine: 4 , virtualIndex: 6 , flags: D I F l a g P r o t o t y p e d , isOptimized: true , unit: !12 , retainedNodes: !19 )
2016-12-22 08:45:21 +08:00
!17 = !DISubroutineType ( types: !18 )
!18 = ! { !3 , !3 }
!19 = ! { !20 , !21 }
!20 = !DILocalVariable ( name: "a" , arg: 1 , scope: !16 , file: !2 , line: 4 , type: !3 )
!21 = !DILocalVariable ( name: "b" , scope: !22 , file: !2 , line: 4 , type: !3 )
!22 = distinct !DILexicalBlock ( scope: !16 , file: !2 , line: 4 )
!23 = !DIExpression ( )
!24 = !DILocation ( line: 4 , scope: !16 )
!25 = !DILocation ( line: 4 , scope: !22 )
[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 10:40:45 +08:00
!26 = distinct !DISubprogram ( name: "get2" , linkageName: "get2" , scope: !2 , file: !2 , line: 7 , type: !17 , isLocal: false , isDefinition: true , scopeLine: 7 , virtualIndex: 6 , flags: D I F l a g P r o t o t y p e d , isOptimized: true , unit: !12 , retainedNodes: !27 )
2016-12-22 08:45:21 +08:00
!27 = ! { !28 , !29 }
!28 = !DILocalVariable ( name: "a" , arg: 1 , scope: !26 , file: !2 , line: 7 , type: !3 )
!29 = !DILocalVariable ( name: "b" , scope: !30 , file: !2 , line: 7 , type: !3 )
!30 = distinct !DILexicalBlock ( scope: !26 , file: !2 , line: 7 )
!31 = !DILocation ( line: 7 , scope: !26 )
!32 = !DILocation ( line: 7 , scope: !30 )
[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 10:40:45 +08:00
!33 = distinct !DISubprogram ( name: "get3" , linkageName: "get3" , scope: !2 , file: !2 , line: 10 , type: !17 , isLocal: false , isDefinition: true , scopeLine: 10 , virtualIndex: 6 , flags: D I F l a g P r o t o t y p e d , isOptimized: true , unit: !12 , retainedNodes: !34 )
2016-12-22 08:45:21 +08:00
!34 = ! { !35 , !36 }
!35 = !DILocalVariable ( name: "a" , arg: 1 , scope: !33 , file: !2 , line: 10 , type: !3 )
!36 = !DILocalVariable ( name: "b" , scope: !37 , file: !2 , line: 10 , type: !3 )
!37 = distinct !DILexicalBlock ( scope: !33 , file: !2 , line: 10 )
!38 = !DILocation ( line: 10 , scope: !33 )
!39 = !DILocation ( line: 10 , scope: !37 )
[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 10:40:45 +08:00
!40 = distinct !DISubprogram ( name: "get4" , linkageName: "get4" , scope: !2 , file: !2 , line: 13 , type: !17 , isLocal: false , isDefinition: true , scopeLine: 13 , virtualIndex: 6 , flags: D I F l a g P r o t o t y p e d , isOptimized: true , unit: !12 , retainedNodes: !41 )
2016-12-22 08:45:21 +08:00
!41 = ! { !42 , !43 }
!42 = !DILocalVariable ( name: "a" , arg: 1 , scope: !40 , file: !2 , line: 13 , type: !3 )
!43 = !DILocalVariable ( name: "b" , scope: !44 , file: !2 , line: 13 , type: !3 )
!44 = distinct !DILexicalBlock ( scope: !40 , file: !2 , line: 13 )
!45 = !DILocation ( line: 13 , scope: !40 )
!46 = !DILocation ( line: 13 , scope: !44 )
[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 10:40:45 +08:00
!47 = distinct !DISubprogram ( name: "get5" , linkageName: "get5" , scope: !2 , file: !2 , line: 16 , type: !17 , isLocal: false , isDefinition: true , scopeLine: 16 , virtualIndex: 6 , flags: D I F l a g P r o t o t y p e d , isOptimized: true , unit: !12 , retainedNodes: !48 )
2016-12-22 08:45:21 +08:00
!48 = ! { !49 , !50 }
!49 = !DILocalVariable ( name: "a" , arg: 1 , scope: !47 , file: !2 , line: 16 , type: !3 )
!50 = !DILocalVariable ( name: "b" , scope: !51 , file: !2 , line: 16 , type: !3 )
!51 = distinct !DILexicalBlock ( scope: !47 , file: !2 , line: 16 )
!52 = !DILocation ( line: 16 , scope: !47 )
!53 = !DILocation ( line: 16 , scope: !51 )