2013-04-11 03:53:26 +08:00
|
|
|
; REQUIRES: object-emission
|
|
|
|
|
2014-01-30 09:39:17 +08:00
|
|
|
; RUN: %llc_dwarf -generate-dwarf-pub-sections=Enable -filetype=obj -o %t.o < %s
|
2013-02-13 02:00:14 +08:00
|
|
|
; RUN: llvm-dwarfdump -debug-dump=pubnames %t.o | FileCheck %s
|
|
|
|
; ModuleID = 'dwarf-public-names.cpp'
|
|
|
|
;
|
|
|
|
; Generated from:
|
|
|
|
;
|
|
|
|
; struct C {
|
|
|
|
; void member_function();
|
|
|
|
; static int static_member_function();
|
|
|
|
; static int static_member_variable;
|
|
|
|
; };
|
|
|
|
;
|
|
|
|
; int C::static_member_variable = 0;
|
|
|
|
;
|
|
|
|
; void C::member_function() {
|
|
|
|
; static_member_variable = 0;
|
|
|
|
; }
|
|
|
|
;
|
|
|
|
; int C::static_member_function() {
|
|
|
|
; return static_member_variable;
|
|
|
|
; }
|
|
|
|
;
|
|
|
|
; C global_variable;
|
|
|
|
;
|
|
|
|
; int global_function() {
|
|
|
|
; return -1;
|
|
|
|
; }
|
|
|
|
;
|
|
|
|
; namespace ns {
|
|
|
|
; void global_namespace_function() {
|
|
|
|
; global_variable.member_function();
|
|
|
|
; }
|
|
|
|
; int global_namespace_variable = 1;
|
|
|
|
; }
|
|
|
|
|
|
|
|
; Skip the output to the header of the pubnames section.
|
|
|
|
; CHECK: debug_pubnames
|
2014-11-02 07:42:30 +08:00
|
|
|
; CHECK: version = 0x0002
|
2013-02-13 02:00:14 +08:00
|
|
|
|
|
|
|
; Check for each name in the output.
|
2014-06-07 06:16:56 +08:00
|
|
|
; CHECK-DAG: "ns"
|
2014-06-07 06:29:05 +08:00
|
|
|
; CHECK-DAG: "C::static_member_function"
|
2014-06-07 06:16:56 +08:00
|
|
|
; CHECK-DAG: "global_variable"
|
|
|
|
; CHECK-DAG: "ns::global_namespace_variable"
|
|
|
|
; CHECK-DAG: "ns::global_namespace_function"
|
|
|
|
; CHECK-DAG: "global_function"
|
|
|
|
; CHECK-DAG: "C::static_member_variable"
|
2014-06-07 06:29:05 +08:00
|
|
|
; CHECK-DAG: "C::member_function"
|
2013-02-13 02:00:14 +08:00
|
|
|
|
|
|
|
%struct.C = type { i8 }
|
|
|
|
|
2016-09-13 09:12:59 +08:00
|
|
|
@_ZN1C22static_member_variableE = global i32 0, align 4, !dbg !25
|
|
|
|
@global_variable = global %struct.C zeroinitializer, align 1, !dbg !26
|
|
|
|
@_ZN2ns25global_namespace_variableE = global i32 1, align 4, !dbg !27
|
2013-02-13 02:00:14 +08:00
|
|
|
|
2015-11-06 06:03:56 +08:00
|
|
|
define void @_ZN1C15member_functionEv(%struct.C* %this) nounwind uwtable align 2 !dbg !3 {
|
2013-02-13 02:00:14 +08:00
|
|
|
entry:
|
|
|
|
%this.addr = alloca %struct.C*, align 8
|
|
|
|
store %struct.C* %this, %struct.C** %this.addr, align 8
|
2015-04-30 00:38:44 +08:00
|
|
|
call void @llvm.dbg.declare(metadata %struct.C** %this.addr, metadata !28, metadata !DIExpression()), !dbg !30
|
2015-02-28 05:17:42 +08:00
|
|
|
%this1 = load %struct.C*, %struct.C** %this.addr
|
2013-02-13 02:00:14 +08:00
|
|
|
store i32 0, i32* @_ZN1C22static_member_variableE, align 4, !dbg !31
|
|
|
|
ret void, !dbg !32
|
|
|
|
}
|
|
|
|
|
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) nounwind readnone
|
2013-02-13 02:00:14 +08:00
|
|
|
|
2015-11-06 06:03:56 +08:00
|
|
|
define i32 @_ZN1C22static_member_functionEv() nounwind uwtable align 2 !dbg !18 {
|
2013-02-13 02:00:14 +08:00
|
|
|
entry:
|
2015-02-28 05:17:42 +08:00
|
|
|
%0 = load i32, i32* @_ZN1C22static_member_variableE, align 4, !dbg !33
|
2013-02-13 02:00:14 +08:00
|
|
|
ret i32 %0, !dbg !33
|
|
|
|
}
|
|
|
|
|
2015-11-06 06:03:56 +08:00
|
|
|
define i32 @_Z15global_functionv() nounwind uwtable !dbg !19 {
|
2013-02-13 02:00:14 +08:00
|
|
|
entry:
|
|
|
|
ret i32 -1, !dbg !34
|
|
|
|
}
|
|
|
|
|
2015-11-06 06:03:56 +08:00
|
|
|
define void @_ZN2ns25global_namespace_functionEv() nounwind uwtable !dbg !20 {
|
2013-02-13 02:00:14 +08:00
|
|
|
entry:
|
|
|
|
call void @_ZN1C15member_functionEv(%struct.C* @global_variable), !dbg !35
|
|
|
|
ret void, !dbg !36
|
|
|
|
}
|
|
|
|
|
|
|
|
attributes #0 = { nounwind uwtable }
|
|
|
|
attributes #1 = { nounwind readnone }
|
|
|
|
|
|
|
|
!llvm.dbg.cu = !{!0}
|
2013-11-23 05:49:45 +08:00
|
|
|
!llvm.module.flags = !{!38}
|
2013-02-13 02:00:14 +08:00
|
|
|
|
2016-04-15 23:57:41 +08:00
|
|
|
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.3 (http://llvm.org/git/clang.git a09cd8103a6a719cb2628cdf0c91682250a17bd2) (http://llvm.org/git/llvm.git 47d03cec0afca0c01ae42b82916d1d731716cd20)", isOptimized: false, emissionKind: FullDebug, file: !37, enums: !1, retainedTypes: !1, globals: !24, imports: !1)
|
IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly. These
are the matching assembly changes for the metadata/value split in
r223802.
- Only use the `metadata` type when referencing metadata from a call
intrinsic -- i.e., only when it's used as a `Value`.
- Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
when referencing it from call intrinsics.
So, assembly like this:
define @foo(i32 %v) {
call void @llvm.foo(metadata !{i32 %v}, metadata !0)
call void @llvm.foo(metadata !{i32 7}, metadata !0)
call void @llvm.foo(metadata !1, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{metadata !3}, metadata !0)
ret void, !bar !2
}
!0 = metadata !{metadata !2}
!1 = metadata !{i32* @global}
!2 = metadata !{metadata !3}
!3 = metadata !{}
turns into this:
define @foo(i32 %v) {
call void @llvm.foo(metadata i32 %v, metadata !0)
call void @llvm.foo(metadata i32 7, metadata !0)
call void @llvm.foo(metadata i32* @global, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{!3}, metadata !0)
ret void, !bar !2
}
!0 = !{!2}
!1 = !{i32* @global}
!2 = !{!3}
!3 = !{}
I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines). I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.
This is part of PR21532.
llvm-svn: 224257
2014-12-16 03:07:53 +08:00
|
|
|
!1 = !{}
|
2016-04-15 23:57:41 +08:00
|
|
|
!3 = distinct !DISubprogram(name: "member_function", linkageName: "_ZN1C15member_functionEv", line: 9, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 9, file: !4, scope: null, type: !5, declaration: !12, variables: !1)
|
2015-04-30 00:38:44 +08:00
|
|
|
!4 = !DIFile(filename: "dwarf-public-names.cpp", directory: "/usr2/kparzysz/s.hex/t")
|
|
|
|
!5 = !DISubroutineType(types: !6)
|
IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly. These
are the matching assembly changes for the metadata/value split in
r223802.
- Only use the `metadata` type when referencing metadata from a call
intrinsic -- i.e., only when it's used as a `Value`.
- Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
when referencing it from call intrinsics.
So, assembly like this:
define @foo(i32 %v) {
call void @llvm.foo(metadata !{i32 %v}, metadata !0)
call void @llvm.foo(metadata !{i32 7}, metadata !0)
call void @llvm.foo(metadata !1, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{metadata !3}, metadata !0)
ret void, !bar !2
}
!0 = metadata !{metadata !2}
!1 = metadata !{i32* @global}
!2 = metadata !{metadata !3}
!3 = metadata !{}
turns into this:
define @foo(i32 %v) {
call void @llvm.foo(metadata i32 %v, metadata !0)
call void @llvm.foo(metadata i32 7, metadata !0)
call void @llvm.foo(metadata i32* @global, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{!3}, metadata !0)
ret void, !bar !2
}
!0 = !{!2}
!1 = !{i32* @global}
!2 = !{!3}
!3 = !{}
I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines). I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.
This is part of PR21532.
llvm-svn: 224257
2014-12-16 03:07:53 +08:00
|
|
|
!6 = !{null, !7}
|
2015-04-30 00:38:44 +08:00
|
|
|
!7 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !8)
|
|
|
|
!8 = !DICompositeType(tag: DW_TAG_structure_type, name: "C", line: 1, size: 8, align: 8, file: !37, elements: !9)
|
IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly. These
are the matching assembly changes for the metadata/value split in
r223802.
- Only use the `metadata` type when referencing metadata from a call
intrinsic -- i.e., only when it's used as a `Value`.
- Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
when referencing it from call intrinsics.
So, assembly like this:
define @foo(i32 %v) {
call void @llvm.foo(metadata !{i32 %v}, metadata !0)
call void @llvm.foo(metadata !{i32 7}, metadata !0)
call void @llvm.foo(metadata !1, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{metadata !3}, metadata !0)
ret void, !bar !2
}
!0 = metadata !{metadata !2}
!1 = metadata !{i32* @global}
!2 = metadata !{metadata !3}
!3 = metadata !{}
turns into this:
define @foo(i32 %v) {
call void @llvm.foo(metadata i32 %v, metadata !0)
call void @llvm.foo(metadata i32 7, metadata !0)
call void @llvm.foo(metadata i32* @global, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{!3}, metadata !0)
ret void, !bar !2
}
!0 = !{!2}
!1 = !{i32* @global}
!2 = !{!3}
!3 = !{}
I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines). I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.
This is part of PR21532.
llvm-svn: 224257
2014-12-16 03:07:53 +08:00
|
|
|
!9 = !{!10, !12, !14}
|
2015-04-30 00:38:44 +08:00
|
|
|
!10 = !DIDerivedType(tag: DW_TAG_member, name: "static_member_variable", line: 4, flags: DIFlagStaticMember, file: !37, scope: !8, baseType: !11)
|
|
|
|
!11 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
|
|
|
|
!12 = !DISubprogram(name: "member_function", linkageName: "_ZN1C15member_functionEv", line: 2, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !4, scope: !8, type: !5, variables: !13)
|
2015-03-04 01:24:31 +08:00
|
|
|
!13 = !{} ; previously: invalid DW_TAG_base_type
|
2015-04-30 00:38:44 +08:00
|
|
|
!14 = !DISubprogram(name: "static_member_function", linkageName: "_ZN1C22static_member_functionEv", line: 3, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 3, file: !4, scope: !8, type: !15, variables: !17)
|
|
|
|
!15 = !DISubroutineType(types: !16)
|
IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly. These
are the matching assembly changes for the metadata/value split in
r223802.
- Only use the `metadata` type when referencing metadata from a call
intrinsic -- i.e., only when it's used as a `Value`.
- Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
when referencing it from call intrinsics.
So, assembly like this:
define @foo(i32 %v) {
call void @llvm.foo(metadata !{i32 %v}, metadata !0)
call void @llvm.foo(metadata !{i32 7}, metadata !0)
call void @llvm.foo(metadata !1, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{metadata !3}, metadata !0)
ret void, !bar !2
}
!0 = metadata !{metadata !2}
!1 = metadata !{i32* @global}
!2 = metadata !{metadata !3}
!3 = metadata !{}
turns into this:
define @foo(i32 %v) {
call void @llvm.foo(metadata i32 %v, metadata !0)
call void @llvm.foo(metadata i32 7, metadata !0)
call void @llvm.foo(metadata i32* @global, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{!3}, metadata !0)
ret void, !bar !2
}
!0 = !{!2}
!1 = !{i32* @global}
!2 = !{!3}
!3 = !{}
I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines). I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.
This is part of PR21532.
llvm-svn: 224257
2014-12-16 03:07:53 +08:00
|
|
|
!16 = !{!11}
|
2015-03-04 01:24:31 +08:00
|
|
|
!17 = !{} ; previously: invalid DW_TAG_base_type
|
2016-04-15 23:57:41 +08:00
|
|
|
!18 = distinct !DISubprogram(name: "static_member_function", linkageName: "_ZN1C22static_member_functionEv", line: 13, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 13, file: !4, scope: null, type: !15, declaration: !14, variables: !1)
|
|
|
|
!19 = distinct !DISubprogram(name: "global_function", linkageName: "_Z15global_functionv", line: 19, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 19, file: !4, scope: !4, type: !15, variables: !1)
|
|
|
|
!20 = distinct !DISubprogram(name: "global_namespace_function", linkageName: "_ZN2ns25global_namespace_functionEv", line: 24, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 24, file: !4, scope: !21, type: !22, variables: !1)
|
2015-04-30 00:38:44 +08:00
|
|
|
!21 = !DINamespace(name: "ns", line: 23, file: !4, scope: null)
|
|
|
|
!22 = !DISubroutineType(types: !23)
|
IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly. These
are the matching assembly changes for the metadata/value split in
r223802.
- Only use the `metadata` type when referencing metadata from a call
intrinsic -- i.e., only when it's used as a `Value`.
- Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
when referencing it from call intrinsics.
So, assembly like this:
define @foo(i32 %v) {
call void @llvm.foo(metadata !{i32 %v}, metadata !0)
call void @llvm.foo(metadata !{i32 7}, metadata !0)
call void @llvm.foo(metadata !1, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{metadata !3}, metadata !0)
ret void, !bar !2
}
!0 = metadata !{metadata !2}
!1 = metadata !{i32* @global}
!2 = metadata !{metadata !3}
!3 = metadata !{}
turns into this:
define @foo(i32 %v) {
call void @llvm.foo(metadata i32 %v, metadata !0)
call void @llvm.foo(metadata i32 7, metadata !0)
call void @llvm.foo(metadata i32* @global, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{!3}, metadata !0)
ret void, !bar !2
}
!0 = !{!2}
!1 = !{i32* @global}
!2 = !{!3}
!3 = !{}
I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines). I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.
This is part of PR21532.
llvm-svn: 224257
2014-12-16 03:07:53 +08:00
|
|
|
!23 = !{null}
|
|
|
|
!24 = !{!25, !26, !27}
|
2016-09-13 09:12:59 +08:00
|
|
|
!25 = !DIGlobalVariable(name: "static_member_variable", linkageName: "_ZN1C22static_member_variableE", line: 7, isLocal: false, isDefinition: true, scope: !8, file: !4, type: !11, declaration: !10)
|
|
|
|
!26 = !DIGlobalVariable(name: "global_variable", line: 17, isLocal: false, isDefinition: true, scope: null, file: !4, type: !8)
|
|
|
|
!27 = !DIGlobalVariable(name: "global_namespace_variable", linkageName: "_ZN2ns25global_namespace_variableE", line: 27, isLocal: false, isDefinition: true, scope: !21, file: !4, type: !11)
|
2015-08-01 02:58:39 +08:00
|
|
|
!28 = !DILocalVariable(name: "this", line: 9, arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !3, file: !4, type: !29)
|
2015-04-30 00:38:44 +08:00
|
|
|
!29 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !8)
|
|
|
|
!30 = !DILocation(line: 9, scope: !3)
|
|
|
|
!31 = !DILocation(line: 10, scope: !3)
|
|
|
|
!32 = !DILocation(line: 11, scope: !3)
|
|
|
|
!33 = !DILocation(line: 14, scope: !18)
|
|
|
|
!34 = !DILocation(line: 20, scope: !19)
|
|
|
|
!35 = !DILocation(line: 25, scope: !20)
|
|
|
|
!36 = !DILocation(line: 26, scope: !20)
|
|
|
|
!37 = !DIFile(filename: "dwarf-public-names.cpp", directory: "/usr2/kparzysz/s.hex/t")
|
2015-03-04 01:24:31 +08:00
|
|
|
!38 = !{i32 1, !"Debug Info Version", i32 3}
|