2013-07-27 01:02:41 +08:00
2014-07-26 01:11:58 +08:00
; RUN: llc < %s -o %t -filetype=obj -O0 -generate-type-units -mtriple=x86_64-unknown-linux-gnu
2017-09-12 07:05:20 +08:00
; RUN: llvm-dwarfdump -v %t | FileCheck --check-prefix=CHECK --check-prefix=SINGLE %s
2019-05-01 17:28:24 +08:00
; RUN: llvm-readobj -S --symbols %t | FileCheck --check-prefix=OBJ_SINGLE %s
2014-01-10 09:38:41 +08:00
2017-04-22 07:35:26 +08:00
; RUN: llc < %s -split-dwarf-file=foo.dwo -o %t -filetype=obj -O0 -generate-type-units -mtriple=x86_64-unknown-linux-gnu
2017-09-12 07:05:20 +08:00
; RUN: llvm-dwarfdump -v %t | FileCheck --check-prefix=CHECK --check-prefix=FISSION %s
2019-05-01 17:28:24 +08:00
; RUN: llvm-readobj -S --symbols %t | FileCheck --check-prefix=OBJ_FISSION %s
2013-11-26 08:22:37 +08:00
2014-02-12 08:40:47 +08:00
; Generated from bar.cpp:
; #line 1 "bar.h"
2013-07-27 01:02:41 +08:00
; struct bar {};
2014-02-12 08:40:47 +08:00
; #line 2 "bar.cpp"
2013-07-30 07:53:08 +08:00
2013-07-27 01:02:41 +08:00
; struct bar b;
2013-07-30 07:53:08 +08:00
2013-07-27 01:02:41 +08:00
; void foo(void) {
; struct baz {};
; baz b;
; }
2013-07-30 07:53:08 +08:00
2013-07-27 01:02:41 +08:00
; namespace echidna {
; namespace capybara {
; namespace mongoose {
; class fluffy {
; int a;
; int b;
; };
2013-07-30 07:53:08 +08:00
2013-07-27 01:02:41 +08:00
; fluffy animal;
; }
; }
; }
2013-07-30 07:53:08 +08:00
2013-07-27 01:02:41 +08:00
; namespace {
2013-07-30 07:53:08 +08:00
; struct walrus {
; walrus() {}
; };
2013-07-27 01:02:41 +08:00
; }
2013-07-30 07:53:08 +08:00
2013-07-27 01:02:41 +08:00
; walrus w;
2013-07-30 07:53:08 +08:00
2013-07-30 07:53:05 +08:00
; struct wombat {
; struct {
2013-07-30 07:53:08 +08:00
; int a;
; int b;
2013-07-30 07:53:05 +08:00
; } a_b;
; };
2013-07-30 07:53:08 +08:00
2013-07-30 07:53:05 +08:00
; wombat wom;
2013-07-27 01:02:41 +08:00
2014-01-10 09:38:41 +08:00
; SINGLE-LABEL: .debug_info contents:
; FISSION-LABEL: .debug_info.dwo contents:
2013-12-05 09:00:12 +08:00
; CHECK: Compile Unit: length = [[CU_SIZE:[0-9a-f]+]]
2013-12-14 05:33:40 +08:00
2014-03-06 09:42:00 +08:00
; CHECK: [[BAR:^0x........]]: DW_TAG_structure_type
2014-02-01 03:52:26 +08:00
; CHECK-NEXT: DW_AT_declaration
2014-03-06 09:42:00 +08:00
; CHECK-NEXT: DW_AT_signature {{.*}} (0x1d02f3be30cc5688)
; CHECK: [[FLUFFY:^0x........]]: DW_TAG_class_type
2014-02-01 03:52:26 +08:00
; CHECK-NEXT: DW_AT_declaration
2014-03-06 09:42:00 +08:00
; CHECK-NEXT: DW_AT_signature {{.*}} (0xb04af47397402e77)
2014-01-04 02:59:42 +08:00
; Ensure the CU-local type 'walrus' is not placed in a type unit.
2014-03-06 09:42:00 +08:00
; CHECK: [[WALRUS:^0x........]]: DW_TAG_structure_type
2014-01-10 09:38:41 +08:00
; CHECK-NEXT: DW_AT_name{{.*}}"walrus"
2014-01-04 02:59:42 +08:00
; CHECK-NEXT: DW_AT_byte_size
; CHECK-NEXT: DW_AT_decl_file
; CHECK-NEXT: DW_AT_decl_line
2014-03-06 09:42:00 +08:00
; CHECK: [[WOMBAT:^0x........]]: DW_TAG_structure_type
; CHECK-NEXT: DW_AT_declaration
; CHECK-NEXT: DW_AT_signature {{.*}} (0xfd756cee88f8a118)
2014-01-10 09:38:41 +08:00
; SINGLE-LABEL: .debug_types contents:
2017-09-14 06:09:01 +08:00
; FISSION: .debug_types.dwo contents:
2013-12-14 05:33:40 +08:00
2013-12-13 09:24:54 +08:00
; Check that we generate a hash for bar and the value.
2014-01-04 02:59:42 +08:00
; CHECK-NOT: type_signature
; CHECK-LABEL: type_signature = 0x1d02f3be30cc5688
2013-12-13 09:24:54 +08:00
; CHECK: DW_TAG_structure_type
2018-12-22 16:43:08 +08:00
; FISSION-NEXT: DW_AT_name {{.*}} (indexed {{.*}} "bar"
Provide gmlt-like inline scope information in the skeleton CU to facilitate symbolication without needing the .dwo files
Clang -gsplit-dwarf self-host -O0, binary increases by 0.0005%, -O2,
binary increases by 25%.
A large binary inside Google, split-dwarf, -O0, and other internal flags
(GDB index, etc) increases by 1.8%, optimized build is 35%.
The size impact may be somewhat greater in .o files (I haven't measured
that much - since the linked executable -O0 numbers seemed low enough)
due to relocations. These relocations could be removed if we taught the
llvm-symbolizer to handle indexed addressing in the .o file (GDB can't
cope with this just yet, but GDB won't be reading this info anyway).
Also debug_ranges could be shared between .o and .dwo, though ideally
debug_ranges would get a schema that could used index(+offset)
addressing, and move to the .dwo file, then we'd be back to sharing
addresses in the address pool again.
But for now, these sizes seem small enough to go ahead with this.
Verified that no other DW_TAGs are produced into the .o file other than
subprograms and inlined_subroutines.
llvm-svn: 221306
2014-11-05 06:12:25 +08:00
; SINGLE-NEXT: DW_AT_name {{.*}} "bar"
2013-11-20 07:08:21 +08:00
; Check that we generate a hash for fluffy and the value.
2014-01-04 02:59:42 +08:00
; CHECK-NOT: type_signature
; CHECK-LABEL: type_signature = 0xb04af47397402e77
; CHECK-NOT: DW_AT_GNU_odr_signature [DW_FORM_data8] (0x9a0124d5a0c21c52)
2013-07-27 01:02:41 +08:00
; CHECK: DW_TAG_namespace
2014-01-10 09:38:41 +08:00
; CHECK-NEXT: DW_AT_name{{.*}}"echidna"
2013-07-27 01:02:41 +08:00
; CHECK: DW_TAG_namespace
2014-01-10 09:38:41 +08:00
; CHECK-NEXT: DW_AT_name{{.*}}"capybara"
2013-07-27 01:02:41 +08:00
; CHECK: DW_TAG_namespace
2014-01-10 09:38:41 +08:00
; CHECK-NEXT: DW_AT_name{{.*}}"mongoose"
2013-07-27 01:02:41 +08:00
; CHECK: DW_TAG_class_type
2014-01-10 09:38:41 +08:00
; CHECK-NEXT: DW_AT_name{{.*}}"fluffy"
2013-07-30 07:53:05 +08:00
2013-12-13 09:24:54 +08:00
; Check that we generate a hash for wombat and the value, but not for the
; anonymous type contained within.
2014-01-04 02:59:42 +08:00
; CHECK-NOT: type_signature
; CHECK-LABEL: type_signature = 0xfd756cee88f8a118
; CHECK-NOT: DW_AT_GNU_odr_signature [DW_FORM_data8] (0x685bcc220141e9d7)
2013-12-13 09:24:54 +08:00
; CHECK: DW_TAG_structure_type
2014-01-10 09:38:41 +08:00
; CHECK-NEXT: DW_AT_name{{.*}}"wombat"
2013-12-14 05:33:40 +08:00
2014-01-04 02:59:42 +08:00
; CHECK-NOT: type_signature
; CHECK-LABEL: type_signature = 0xe94f6d3843e62d6b
2013-12-13 09:24:54 +08:00
; CHECK: DW_TAG_type_unit
2014-03-18 09:17:26 +08:00
; CHECK: DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000)
2013-12-14 05:33:40 +08:00
; CHECK-NOT: NULL
; CHECK-NOT: DW_AT_GNU_odr_signature
2013-12-13 09:24:54 +08:00
; CHECK: DW_TAG_structure_type
2013-12-14 05:33:40 +08:00
; The signature for the outer 'wombat' type
2014-01-04 02:59:42 +08:00
; CHECK: DW_AT_signature [DW_FORM_ref_sig8] (0xfd756cee88f8a118)
2013-07-30 07:53:05 +08:00
; CHECK: DW_TAG_structure_type
2013-11-20 07:08:21 +08:00
; CHECK-NOT: DW_AT_name
; CHECK-NOT: DW_AT_GNU_odr_signature
2013-07-30 07:53:05 +08:00
; CHECK: DW_TAG_member
2014-01-10 09:38:41 +08:00
; CHECK-NEXT: DW_AT_name{{.*}}"a"
2013-07-30 07:53:05 +08:00
2014-02-15 03:51:35 +08:00
; CHECK-LABEL: .debug_line contents:
; CHECK: Line table prologue
; CHECK-NOT: file_names[
2018-02-24 07:01:06 +08:00
; SINGLE: file_names[
; SINGLE-NEXT: name: "bar.h"
; CHECK: file_names[
; CHECK-NEXT: name: "bar.cpp"
2014-02-15 03:51:35 +08:00
; CHECK-NOT: file_names[
2014-03-18 09:17:26 +08:00
2017-09-14 06:09:01 +08:00
; FISSION: .debug_line.dwo contents:
; CHECK-NOT: .debug_line.dwo contents:
2014-03-18 09:17:26 +08:00
; FISSION: Line table prologue
2014-03-18 10:13:23 +08:00
; FISSION: opcode_base: 1
; FISSION-NOT: standard_opcode_lengths
2014-03-19 08:11:28 +08:00
; FISSION-NOT: include_directories
2014-03-18 09:17:26 +08:00
; FISSION-NOT: file_names[
2018-02-24 07:01:06 +08:00
; FISSION: file_names[
; FISSION-NEXT: name: "bar.h"
; FISSION: file_names[
; FISSION-NEXT: name: "bar.cpp"
2014-03-18 09:17:26 +08:00
; FISSION-NOT: file_names[
2014-02-15 03:51:35 +08:00
; CHECK-LABEL: .debug_str contents:
2013-11-27 03:14:34 +08:00
; Use the unit size as a rough hash/identifier for the unit we're dealing with
; it happens to be unambiguous at the moment, but it's hardly ideal.
2013-11-26 08:22:37 +08:00
; CHECK-LABEL: .debug_pubtypes contents:
2013-11-27 03:14:34 +08:00
; Don't emit pubtype entries for type DIEs in the compile unit that just indirect to a type unit.
2013-12-05 09:00:12 +08:00
; CHECK-NEXT: unit_size = [[CU_SIZE]]
2013-11-27 03:14:34 +08:00
; CHECK-NEXT: Offset Name
2014-06-07 06:16:56 +08:00
; CHECK-DAG: [[BAR]] "bar"
; CHECK-DAG: [[WALRUS]] "(anonymous namespace)::walrus"
; CHECK-DAG: [[WOMBAT]] "wombat"
; CHECK-DAG: [[FLUFFY]] "echidna::capybara::mongoose::fluffy"
2013-11-26 08:22:37 +08:00
2014-07-26 01:11:58 +08:00
; Make sure debug_types are in comdat groups. This could be more rigid to check
; that they're the right comdat groups (each type in a separate comdat group,
; etc)
2014-08-27 13:04:14 +08:00
; OBJ_SINGLE: Name: .debug_types (
; OBJ_SINGLE-NOT: }
; OBJ_SINGLE: SHF_GROUP
2014-07-26 01:11:58 +08:00
; Fission type units don't go in comdat groups, since their linker is debug
; aware it's handled using the debug info semantics rather than raw ELF object
; semantics.
; OBJ_FISSION: Name: .debug_types.dwo (
; OBJ_FISSION-NOT: SHF_GROUP
; OBJ_FISSION: }
2016-12-22 08:45:21 +08:00
source_filename = "test/DebugInfo/X86/generate-odr-hash.ll"
2013-07-27 01:02:41 +08:00
%struct.bar = type { i8 }
%"class.echidna::capybara::mongoose::fluffy" = type { i32 , i32 }
2013-07-30 07:53:08 +08:00
%"struct.<anonymous namespace>::walrus" = type { i8 }
2013-07-30 07:53:05 +08:00
%struct.wombat = type { %struct.anon }
%struct.anon = type { i32 , i32 }
2013-07-27 01:02:41 +08:00
%struct.baz = type { i8 }
2016-12-22 08:45:21 +08:00
@b = global %struct.bar zeroinitializer , align 1 , !dbg !0
@_ZN7echidna8capybara8mongoose6animalE = global %"class.echidna::capybara::mongoose::fluffy" zeroinitializer , align 4 , !dbg !6
@w = internal global %"struct.<anonymous namespace>::walrus" zeroinitializer , align 1 , !dbg !16
@wom = global %struct.wombat zeroinitializer , align 4 , !dbg !25
2019-05-15 10:35:32 +08:00
@llvm.global_ctors = appending global [ 1 x { i32 , void ( ) * , i8 * } ] [ { i32 , void ( ) * , i8 * } { i32 65535 , void ( ) * @_GLOBAL__I_a , i8 * null } ]
2013-07-30 07:53:08 +08:00
2013-07-27 01:02:41 +08:00
; Function Attrs: nounwind uwtable
2016-12-22 08:45:21 +08:00
define void @_Z3foov ( ) #0 !dbg !40 {
2013-07-27 01:02:41 +08:00
entry:
%b = alloca %struct.baz , align 1
2016-12-22 08:45:21 +08:00
call void @llvm.dbg.declare ( metadata %struct.baz * %b , metadata !43 , metadata !45 ) , !dbg !46
ret void , !dbg !47
2013-07-27 01:02:41 +08:00
}
; Function Attrs: nounwind readnone
Move the complex address expression out of DIVariable and into an extra
argument of the llvm.dbg.declare/llvm.dbg.value intrinsics.
Previously, DIVariable was a variable-length field that has an optional
reference to a Metadata array consisting of a variable number of
complex address expressions. In the case of OpPiece expressions this is
wasting a lot of storage in IR, because when an aggregate type is, e.g.,
SROA'd into all of its n individual members, the IR will contain n copies
of the DIVariable, all alike, only differing in the complex address
reference at the end.
By making the complex address into an extra argument of the
dbg.value/dbg.declare intrinsics, all of the pieces can reference the
same variable and the complex address expressions can be uniqued across
the CU, too.
Down the road, this will allow us to move other flags, such as
"indirection" out of the DIVariable, too.
The new intrinsics look like this:
declare void @llvm.dbg.declare(metadata %storage, metadata %var, metadata %expr)
declare void @llvm.dbg.value(metadata %storage, i64 %offset, metadata %var, metadata %expr)
This patch adds a new LLVM-local tag to DIExpressions, so we can detect
and pretty-print DIExpression metadata nodes.
What this patch doesn't do:
This patch does not touch the "Indirect" field in DIVariable; but moving
that into the expression would be a natural next step.
http://reviews.llvm.org/D4919
rdar://problem/17994491
Thanks to dblaikie and dexonsmith for reviewing this patch!
Note: I accidentally committed a bogus older version of this patch previously.
llvm-svn: 218787
2014-10-02 02:55:02 +08:00
declare void @llvm.dbg.declare ( metadata , metadata , metadata ) #1
2013-07-27 01:02:41 +08:00
2016-12-22 08:45:21 +08:00
define internal void @__cxx_global_var_init ( ) section ".text.startup" !dbg !48 {
2013-07-30 07:53:08 +08:00
entry:
2016-12-22 08:45:21 +08:00
call void @_ZN12_GLOBAL__N_16walrusC2Ev ( %"struct.<anonymous namespace>::walrus" * @w ) , !dbg !49
ret void , !dbg !49
2013-07-30 07:53:08 +08:00
}
; Function Attrs: nounwind uwtable
2016-12-22 08:45:21 +08:00
define internal void @_ZN12_GLOBAL__N_16walrusC2Ev ( %"struct.<anonymous namespace>::walrus" * %this ) unnamed_addr #0 align 2 !dbg !50 {
2013-07-30 07:53:08 +08:00
entry:
%this.addr = alloca %"struct.<anonymous namespace>::walrus" * , align 8
store %"struct.<anonymous namespace>::walrus" * %this , %"struct.<anonymous namespace>::walrus" * * %this.addr , align 8
2016-12-22 08:45:21 +08:00
call void @llvm.dbg.declare ( metadata %"struct.<anonymous namespace>::walrus" * * %this.addr , metadata !51 , metadata !45 ) , !dbg !53
2015-02-28 05:17:42 +08:00
%this1 = load %"struct.<anonymous namespace>::walrus" * , %"struct.<anonymous namespace>::walrus" * * %this.addr
2014-02-12 08:40:47 +08:00
ret void , !dbg !54
2013-07-30 07:53:08 +08:00
}
2016-12-22 08:45:21 +08:00
define internal void @_GLOBAL__I_a ( ) section ".text.startup" !dbg !55 {
2013-07-30 07:53:08 +08:00
entry:
2016-12-22 08:45:21 +08:00
call void @__cxx_global_var_init ( ) , !dbg !57
ret void , !dbg !57
2013-07-30 07:53:08 +08:00
}
2019-12-25 07:52:21 +08:00
attributes #0 = { nounwind uwtable "less-precise-fpmad" = "false" "frame-pointer" = "all" "no-infs-fp-math" = "false" "no-nans-fp-math" = "false" "stack-protector-buffer-size" = "8" "unsafe-fp-math" = "false" "use-soft-float" = "false" }
2013-07-27 01:02:41 +08:00
attributes #1 = { nounwind readnone }
2016-12-22 08:45:21 +08:00
!llvm.dbg.cu = ! { !34 }
!llvm.module.flags = ! { !37 , !38 }
!llvm.ident = ! { !39 }
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: "b" , scope: null , file: !2 , line: 3 , type: !3 , isLocal: false , isDefinition: true )
!2 = !DIFile ( filename: "bar.cpp" , directory: "/tmp/dbginfo" )
!3 = !DICompositeType ( tag: D W _ T A G _ s t r u c t u r e _ type , name: "bar" , file: !4 , line: 1 , size: 8 , align: 8 , elements: !5 , identifier: "_ZTS3bar" )
!4 = !DIFile ( filename: "bar.h" , directory: "/tmp/dbginfo" )
!5 = ! { }
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: "animal" , linkageName: "_ZN7echidna8capybara8mongoose6animalE" , scope: !8 , file: !2 , line: 18 , type: !11 , isLocal: false , isDefinition: true )
2017-04-29 06:25:46 +08:00
!8 = !DINamespace ( name: "mongoose" , scope: !9 )
!9 = !DINamespace ( name: "capybara" , scope: !10 )
!10 = !DINamespace ( name: "echidna" , scope: null )
2016-12-22 08:45:21 +08:00
!11 = !DICompositeType ( tag: D W _ T A G _ c l a s s _ type , name: "fluffy" , scope: !8 , file: !2 , line: 13 , size: 64 , align: 32 , elements: !12 , identifier: "_ZTSN7echidna8capybara8mongoose6fluffyE" )
!12 = ! { !13 , !15 }
!13 = !DIDerivedType ( tag: D W _ T A G _ m e m b e r , name: "a" , scope: !11 , file: !2 , line: 14 , baseType: !14 , size: 32 , align: 32 , flags: D I F l a g P r i v a t e )
!14 = !DIBasicType ( name: "int" , size: 32 , align: 32 , encoding: D W _ A T E _ s i g n e d )
!15 = !DIDerivedType ( tag: D W _ T A G _ m e m b e r , name: "b" , scope: !11 , file: !2 , line: 15 , baseType: !14 , size: 32 , align: 32 , offset: 32 , flags: D I F l a g P r i v a t e )
2017-08-31 02:06:51 +08:00
!16 = !DIGlobalVariableExpression ( var: !17 , expr: !DIExpression ( ) )
2016-12-22 08:45:21 +08:00
!17 = !DIGlobalVariable ( name: "w" , scope: null , file: !2 , line: 29 , type: !18 , isLocal: true , isDefinition: true )
!18 = !DICompositeType ( tag: D W _ T A G _ s t r u c t u r e _ type , name: "walrus" , scope: !19 , file: !2 , line: 24 , size: 8 , align: 8 , elements: !20 )
2017-04-29 06:25:46 +08:00
!19 = !DINamespace ( scope: null )
2016-12-22 08:45:21 +08:00
!20 = ! { !21 }
!21 = !DISubprogram ( name: "walrus" , scope: !18 , file: !2 , line: 25 , type: !22 , isLocal: false , isDefinition: false , scopeLine: 25 , virtualIndex: 6 , flags: D I F l a g P r o t o t y p e d , isOptimized: false )
!22 = !DISubroutineType ( types: !23 )
!23 = ! { null , !24 }
!24 = !DIDerivedType ( tag: D W _ T A G _ p o i n t e r _ type , baseType: !18 , size: 64 , align: 64 , flags: D I F l a g A r t i f i c i a l | D I F l a g O b j e c t P o i n t e r )
2017-08-31 02:06:51 +08:00
!25 = !DIGlobalVariableExpression ( var: !26 , expr: !DIExpression ( ) )
2016-12-22 08:45:21 +08:00
!26 = !DIGlobalVariable ( name: "wom" , scope: null , file: !2 , line: 38 , type: !27 , isLocal: false , isDefinition: true )
!27 = !DICompositeType ( tag: D W _ T A G _ s t r u c t u r e _ type , name: "wombat" , file: !2 , line: 31 , size: 64 , align: 32 , elements: !28 , identifier: "_ZTS6wombat" )
!28 = ! { !29 }
!29 = !DIDerivedType ( tag: D W _ T A G _ m e m b e r , name: "a_b" , scope: !27 , file: !2 , line: 35 , baseType: !30 , size: 64 , align: 32 )
!30 = !DICompositeType ( tag: D W _ T A G _ s t r u c t u r e _ type , scope: !27 , file: !2 , line: 32 , size: 64 , align: 32 , elements: !31 , identifier: "_ZTSN6wombatUt_E" )
!31 = ! { !32 , !33 }
!32 = !DIDerivedType ( tag: D W _ T A G _ m e m b e r , name: "a" , scope: !30 , file: !2 , line: 33 , baseType: !14 , size: 32 , align: 32 )
!33 = !DIDerivedType ( tag: D W _ T A G _ m e m b e r , name: "b" , scope: !30 , file: !2 , line: 34 , baseType: !14 , size: 32 , align: 32 , offset: 32 )
!34 = distinct !DICompileUnit ( language: D W _ L A N G _ C _ p l u s _ p l u s , file: !2 , producer: "clang version 3.5 " , isOptimized: false , runtimeVersion: 0 , splitDebugFilename: "bar.dwo" , emissionKind: F u l l D e b u g , enums: !5 , retainedTypes: !35 , globals: !36 , imports: !5 )
!35 = ! { !3 , !11 , !27 , !30 }
!36 = ! { !0 , !6 , !16 , !25 }
!37 = ! { i32 2 , !"Dwarf Version" , i32 4 }
!38 = ! { i32 1 , !"Debug Info Version" , i32 3 }
!39 = ! { !"clang version 3.5 " }
[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: "foo" , linkageName: "_Z3foov" , scope: !2 , file: !2 , line: 5 , type: !41 , isLocal: false , isDefinition: true , scopeLine: 5 , virtualIndex: 6 , flags: D I F l a g P r o t o t y p e d , isOptimized: false , unit: !34 , retainedNodes: !5 )
2016-12-22 08:45:21 +08:00
!41 = !DISubroutineType ( types: !42 )
!42 = ! { null }
!43 = !DILocalVariable ( name: "b" , scope: !40 , file: !2 , line: 7 , type: !44 )
!44 = !DICompositeType ( tag: D W _ T A G _ s t r u c t u r e _ type , name: "baz" , scope: !40 , file: !2 , line: 6 , size: 8 , align: 8 , elements: !5 )
!45 = !DIExpression ( )
!46 = !DILocation ( line: 7 , scope: !40 )
!47 = !DILocation ( line: 8 , scope: !40 )
[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
!48 = distinct !DISubprogram ( name: "__cxx_global_var_init" , scope: !2 , file: !2 , line: 29 , type: !41 , isLocal: true , isDefinition: true , scopeLine: 29 , virtualIndex: 6 , flags: D I F l a g P r o t o t y p e d , isOptimized: false , unit: !34 , retainedNodes: !5 )
2016-12-22 08:45:21 +08:00
!49 = !DILocation ( line: 29 , scope: !48 )
[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
!50 = distinct !DISubprogram ( name: "walrus" , linkageName: "_ZN12_GLOBAL__N_16walrusC2Ev" , scope: !18 , file: !2 , line: 25 , type: !22 , isLocal: true , isDefinition: true , scopeLine: 25 , virtualIndex: 6 , flags: D I F l a g P r o t o t y p e d , isOptimized: false , unit: !34 , declaration: !21 , retainedNodes: !5 )
2016-12-22 08:45:21 +08:00
!51 = !DILocalVariable ( name: "this" , arg: 1 , scope: !50 , type: !52 , flags: D I F l a g A r t i f i c i a l | D I F l a g O b j e c t P o i n t e r )
!52 = !DIDerivedType ( tag: D W _ T A G _ p o i n t e r _ type , baseType: !18 , size: 64 , align: 64 )
!53 = !DILocation ( line: 0 , scope: !50 )
!54 = !DILocation ( line: 25 , scope: !50 )
[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
!55 = distinct !DISubprogram ( linkageName: "_GLOBAL__I_a" , scope: !2 , file: !2 , line: 25 , type: !56 , isLocal: true , isDefinition: true , scopeLine: 25 , virtualIndex: 6 , flags: D I F l a g A r t i f i c i a l , isOptimized: false , unit: !34 , retainedNodes: !5 )
2016-12-22 08:45:21 +08:00
!56 = !DISubroutineType ( types: !5 )
!57 = !DILocation ( line: 25 , scope: !55 )