2013-05-11 05:52:07 +08:00
|
|
|
; REQUIRES: object-emission
|
|
|
|
|
2014-12-17 08:43:22 +08:00
|
|
|
; RUN: llc -mtriple=x86_64-linux -O0 -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s
|
2013-05-11 05:52:07 +08:00
|
|
|
|
|
|
|
; IR generated with `clang++ -g -emit-llvm -S` from the following code:
|
2014-12-17 08:43:22 +08:00
|
|
|
; template<int x, int*, template<typename> class y, decltype(nullptr) n, int ...z> int func() { return 3; }
|
2013-08-02 04:30:22 +08:00
|
|
|
; template<typename> struct y_impl { struct nested { }; };
|
2014-12-17 08:43:22 +08:00
|
|
|
; int glbl = func<3, &glbl, y_impl, nullptr, 1, 2>();
|
2013-08-02 04:30:22 +08:00
|
|
|
; y_impl<int>::nested n;
|
2013-05-11 05:52:07 +08:00
|
|
|
|
|
|
|
; CHECK: [[INT:0x[0-9a-f]*]]:{{ *}}DW_TAG_base_type
|
|
|
|
; CHECK-NEXT: DW_AT_name{{.*}} = "int"
|
|
|
|
|
2013-08-02 04:30:22 +08:00
|
|
|
; CHECK: DW_TAG_structure_type
|
|
|
|
; CHECK-NEXT: DW_AT_name{{.*}}"y_impl<int>"
|
|
|
|
; CHECK-NOT: NULL
|
|
|
|
; CHECK: DW_TAG_template_type_parameter
|
|
|
|
|
2014-12-17 08:43:22 +08:00
|
|
|
; CHECK: DW_AT_name{{.*}}"func<3, &glbl, y_impl, nullptr, 1, 2>"
|
2013-05-11 05:52:07 +08:00
|
|
|
; CHECK-NOT: NULL
|
|
|
|
; CHECK: DW_TAG_template_value_parameter
|
|
|
|
; CHECK-NEXT: DW_AT_type{{.*}}=> {[[INT]]}
|
|
|
|
; CHECK-NEXT: DW_AT_name{{.*}}= "x"
|
2013-08-28 07:49:04 +08:00
|
|
|
; CHECK-NEXT: DW_AT_const_value [DW_FORM_sdata]{{.*}}(3)
|
2013-05-11 05:52:07 +08:00
|
|
|
|
|
|
|
; CHECK: DW_TAG_template_value_parameter
|
2013-10-29 08:58:04 +08:00
|
|
|
; CHECK-NEXT: DW_AT_type{{.*}}=> {[[INTPTR:0x[0-9a-f]*]]}
|
2013-05-11 05:52:07 +08:00
|
|
|
|
|
|
|
; The address of the global 'glbl', followed by DW_OP_stack_value (9f), to use
|
|
|
|
; the value immediately, rather than indirecting through the address.
|
|
|
|
|
2014-02-16 16:46:55 +08:00
|
|
|
; CHECK-NEXT: DW_AT_location [DW_FORM_exprloc]{{ *}}(<0xa> 03 00 00 00 00 00 00 00 00 9f )
|
2013-06-23 02:59:11 +08:00
|
|
|
; CHECK-NOT: NULL
|
|
|
|
|
|
|
|
; CHECK: DW_TAG_GNU_template_template_param
|
|
|
|
; CHECK-NEXT: DW_AT_name{{.*}}= "y"
|
|
|
|
; CHECK-NEXT: DW_AT_GNU_template_name{{.*}}= "y_impl"
|
|
|
|
; CHECK-NOT: NULL
|
|
|
|
|
2014-12-17 08:43:22 +08:00
|
|
|
; CHECK: DW_TAG_template_value_parameter
|
|
|
|
; CHECK-NEXT: DW_AT_type{{.*}}=> {[[NULLPTR:0x[0-9a-f]*]]}
|
|
|
|
; CHECK-NEXT: DW_AT_name{{.*}}= "n"
|
|
|
|
; CHECK-NEXT: DW_AT_const_value [DW_FORM_udata]{{.*}}(0)
|
|
|
|
|
2013-06-23 02:59:11 +08:00
|
|
|
; CHECK: DW_TAG_GNU_template_parameter_pack
|
|
|
|
; CHECK-NOT: NULL
|
|
|
|
; CHECK: DW_TAG_template_value_parameter
|
|
|
|
; CHECK-NEXT: DW_AT_type{{.*}}=> {[[INT]]}
|
2013-08-28 07:49:04 +08:00
|
|
|
; CHECK-NEXT: DW_AT_const_value [DW_FORM_sdata]{{.*}}(1)
|
2013-06-23 02:59:11 +08:00
|
|
|
; CHECK-NOT: NULL
|
|
|
|
; CHECK: DW_TAG_template_value_parameter
|
|
|
|
; CHECK-NEXT: DW_AT_type{{.*}}=> {[[INT]]}
|
2013-08-28 07:49:04 +08:00
|
|
|
; CHECK-NEXT: DW_AT_const_value [DW_FORM_sdata]{{.*}}(2)
|
2013-05-11 05:52:07 +08:00
|
|
|
|
2013-10-29 08:58:04 +08:00
|
|
|
; CHECK: [[INTPTR]]:{{ *}}DW_TAG_pointer_type
|
|
|
|
; CHECK-NEXT: DW_AT_type{{.*}} => {[[INT]]}
|
|
|
|
|
2014-12-17 08:43:22 +08:00
|
|
|
; CHECK: [[NULLPTR]]:{{ *}}DW_TAG_unspecified_type
|
|
|
|
; CHECK-NEXT: DW_AT_name{{.*}}= "decltype(nullptr)"
|
|
|
|
|
2013-08-02 04:30:22 +08:00
|
|
|
%"struct.y_impl<int>::nested" = type { i8 }
|
2013-06-23 02:59:11 +08:00
|
|
|
|
2013-05-11 05:52:07 +08:00
|
|
|
@glbl = global i32 0, align 4
|
2013-08-02 04:30:22 +08:00
|
|
|
@n = global %"struct.y_impl<int>::nested" zeroinitializer, align 1
|
2014-12-17 08:43:22 +08:00
|
|
|
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__sub_I_template.cpp, i8* null }]
|
2013-05-11 05:52:07 +08:00
|
|
|
|
2015-11-06 06:03:56 +08:00
|
|
|
define internal void @__cxx_global_var_init() section ".text.startup" !dbg !10 {
|
2013-05-11 05:52:07 +08:00
|
|
|
entry:
|
2014-12-17 08:43:22 +08:00
|
|
|
%call = call i32 @_Z4funcILi3EXadL_Z4glblEE6y_implLDn0EJLi1ELi2EEEiv(), !dbg !36
|
|
|
|
store i32 %call, i32* @glbl, align 4, !dbg !36
|
|
|
|
ret void, !dbg !36
|
2013-05-11 05:52:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
; Function Attrs: nounwind uwtable
|
2015-11-06 06:03:56 +08:00
|
|
|
define linkonce_odr i32 @_Z4funcILi3EXadL_Z4glblEE6y_implLDn0EJLi1ELi2EEEiv() #0 !dbg !14 {
|
2013-05-11 05:52:07 +08:00
|
|
|
entry:
|
2014-12-17 08:43:22 +08:00
|
|
|
ret i32 3, !dbg !37
|
2013-05-11 05:52:07 +08:00
|
|
|
}
|
|
|
|
|
2014-12-17 08:43:22 +08:00
|
|
|
define internal void @_GLOBAL__sub_I_template.cpp() section ".text.startup" {
|
2013-05-11 05:52:07 +08:00
|
|
|
entry:
|
2014-12-17 08:43:22 +08:00
|
|
|
call void @__cxx_global_var_init(), !dbg !38
|
|
|
|
ret void
|
2013-05-11 05:52:07 +08:00
|
|
|
}
|
|
|
|
|
2013-10-17 09:31:12 +08:00
|
|
|
attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
2013-05-11 05:52:07 +08:00
|
|
|
|
|
|
|
!llvm.dbg.cu = !{!0}
|
2014-12-17 08:43:22 +08:00
|
|
|
!llvm.module.flags = !{!33, !34}
|
|
|
|
!llvm.ident = !{!35}
|
2013-05-11 05:52:07 +08:00
|
|
|
|
2016-04-15 23:57:41 +08:00
|
|
|
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.6.0 (trunk 224394) (llvm/trunk 224384)", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !3, globals: !30, imports: !2)
|
2015-04-30 00:38:44 +08:00
|
|
|
!1 = !DIFile(filename: "template.cpp", directory: "/tmp/dbginfo")
|
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
|
|
|
!2 = !{}
|
|
|
|
!3 = !{!4, !8}
|
2015-04-30 00:38:44 +08:00
|
|
|
!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "y_impl<int>", line: 2, size: 8, align: 8, file: !1, elements: !2, templateParams: !5, identifier: "_ZTS6y_implIiE")
|
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
|
|
|
!5 = !{!6}
|
2015-04-30 00:38:44 +08:00
|
|
|
!6 = !DITemplateTypeParameter(type: !7)
|
|
|
|
!7 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
|
2016-04-24 05:08:00 +08:00
|
|
|
!8 = !DICompositeType(tag: DW_TAG_structure_type, name: "nested", line: 2, size: 8, align: 8, file: !1, scope: !4, elements: !2, identifier: "_ZTSN6y_implIiE6nestedE")
|
2016-04-15 23:57:41 +08:00
|
|
|
!10 = distinct !DISubprogram(name: "__cxx_global_var_init", line: 3, isLocal: true, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 3, file: !1, scope: !11, type: !12, variables: !2)
|
2015-04-30 00:38:44 +08:00
|
|
|
!11 = !DIFile(filename: "template.cpp", directory: "/tmp/dbginfo")
|
|
|
|
!12 = !DISubroutineType(types: !13)
|
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
|
|
|
!13 = !{null}
|
2016-04-15 23:57:41 +08:00
|
|
|
!14 = distinct !DISubprogram(name: "func<3, &glbl, y_impl, nullptr, 1, 2>", linkageName: "_Z4funcILi3EXadL_Z4glblEE6y_implLDn0EJLi1ELi2EEEiv", line: 1, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 1, file: !1, scope: !11, type: !15, templateParams: !17, variables: !2)
|
2015-04-30 00:38:44 +08:00
|
|
|
!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 = !{!7}
|
2014-12-17 08:43:22 +08:00
|
|
|
!17 = !{!18, !19, !21, !22, !24}
|
2015-04-30 00:38:44 +08:00
|
|
|
!18 = !DITemplateValueParameter(tag: DW_TAG_template_value_parameter, name: "x", type: !7, value: i32 3)
|
|
|
|
!19 = !DITemplateValueParameter(tag: DW_TAG_template_value_parameter, type: !20, value: i32* @glbl)
|
|
|
|
!20 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !7)
|
|
|
|
!21 = !DITemplateValueParameter(tag: DW_TAG_GNU_template_template_param, name: "y", type: null, value: !"y_impl")
|
|
|
|
!22 = !DITemplateValueParameter(tag: DW_TAG_template_value_parameter, name: "n", type: !23, value: i8 0)
|
|
|
|
!23 = !DIBasicType(tag: DW_TAG_unspecified_type, name: "decltype(nullptr)")
|
|
|
|
!24 = !DITemplateValueParameter(tag: DW_TAG_GNU_template_parameter_pack, name: "z", type: null, value: !25)
|
2014-12-17 08:43:22 +08:00
|
|
|
!25 = !{!26, !27}
|
2015-04-30 00:38:44 +08:00
|
|
|
!26 = !DITemplateValueParameter(tag: DW_TAG_template_value_parameter, type: !7, value: i32 1)
|
|
|
|
!27 = !DITemplateValueParameter(tag: DW_TAG_template_value_parameter, type: !7, value: i32 2)
|
2016-04-15 23:57:41 +08:00
|
|
|
!28 = distinct !DISubprogram(name: "", linkageName: "_GLOBAL__sub_I_template.cpp", isLocal: true, isDefinition: true, flags: DIFlagArtificial, isOptimized: false, unit: !0, file: !1, scope: !11, type: !29, variables: !2)
|
2015-04-30 00:38:44 +08:00
|
|
|
!29 = !DISubroutineType(types: !2)
|
2014-12-17 08:43:22 +08:00
|
|
|
!30 = !{!31, !32}
|
2015-04-30 00:38:44 +08:00
|
|
|
!31 = !DIGlobalVariable(name: "glbl", line: 3, isLocal: false, isDefinition: true, scope: null, file: !11, type: !7, variable: i32* @glbl)
|
2016-04-24 05:08:00 +08:00
|
|
|
!32 = !DIGlobalVariable(name: "n", line: 4, isLocal: false, isDefinition: true, scope: null, file: !11, type: !8, variable: %"struct.y_impl<int>::nested"* @n)
|
2014-12-17 08:43:22 +08:00
|
|
|
!33 = !{i32 2, !"Dwarf Version", i32 4}
|
2015-03-04 01:24:31 +08:00
|
|
|
!34 = !{i32 2, !"Debug Info Version", i32 3}
|
2014-12-17 08:43:22 +08:00
|
|
|
!35 = !{!"clang version 3.6.0 (trunk 224394) (llvm/trunk 224384)"}
|
2015-04-30 00:38:44 +08:00
|
|
|
!36 = !DILocation(line: 3, column: 12, scope: !10)
|
|
|
|
!37 = !DILocation(line: 1, column: 96, scope: !14)
|
|
|
|
!38 = !DILocation(line: 0, scope: !28)
|