2016-02-12 02:21:47 +08:00
|
|
|
; RUN: llc < %s -mtriple=nvptx64-nvidia-cuda | FileCheck %s
|
|
|
|
|
|
|
|
; // Bitcode int this test case is reduced version of compiled code below:
|
|
|
|
;extern "C" {
|
|
|
|
;#line 1 "/source/dir/foo.h"
|
|
|
|
;__device__ void foo() {}
|
|
|
|
;#line 2 "/source/dir/bar.cu"
|
|
|
|
;__device__ void bar() {}
|
|
|
|
;}
|
|
|
|
|
2019-01-24 02:59:54 +08:00
|
|
|
; CHECK: .target sm_{{[0-9]+}}, debug
|
2018-05-18 11:13:08 +08:00
|
|
|
|
2018-01-05 05:07:07 +08:00
|
|
|
; CHECK: .visible .func foo()
|
2018-05-18 11:13:08 +08:00
|
|
|
; CHECK: .loc [[FOO:[0-9]+]] 1 31
|
2018-01-05 05:07:07 +08:00
|
|
|
; CHECK: ret;
|
|
|
|
; CHECK: .visible .func bar()
|
2018-05-18 11:13:08 +08:00
|
|
|
; CHECK: .loc [[BAR:[0-9]+]] 2 31
|
2018-01-05 05:07:07 +08:00
|
|
|
; CHECK: ret;
|
2016-02-12 02:21:47 +08:00
|
|
|
|
|
|
|
define void @foo() !dbg !4 {
|
|
|
|
bb:
|
|
|
|
ret void, !dbg !10
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @bar() !dbg !7 {
|
|
|
|
bb:
|
|
|
|
ret void, !dbg !11
|
|
|
|
}
|
|
|
|
|
2018-05-18 11:13:08 +08:00
|
|
|
; CHECK-DAG: .file [[FOO]] "{{.*}}foo.h"
|
|
|
|
; CHECK-DAG: .file [[BAR]] "{{.*}}bar.cu"
|
2019-01-24 02:59:54 +08:00
|
|
|
; CHECK: .section .debug_abbrev
|
|
|
|
; CHECK-NEXT: {
|
|
|
|
; CHECK-NEXT: .b8 1 // Abbreviation Code
|
|
|
|
; CHECK-NEXT: .b8 17 // DW_TAG_compile_unit
|
|
|
|
; CHECK-NEXT: .b8 0 // DW_CHILDREN_no
|
|
|
|
; CHECK-NEXT: .b8 37 // DW_AT_producer
|
|
|
|
; CHECK-NEXT: .b8 8 // DW_FORM_string
|
|
|
|
; CHECK-NEXT: .b8 19 // DW_AT_language
|
|
|
|
; CHECK-NEXT: .b8 5 // DW_FORM_data2
|
|
|
|
; CHECK-NEXT: .b8 3 // DW_AT_name
|
|
|
|
; CHECK-NEXT: .b8 8 // DW_FORM_string
|
|
|
|
; CHECK-NEXT: .b8 16 // DW_AT_stmt_list
|
|
|
|
; CHECK-NEXT: .b8 6 // DW_FORM_data4
|
|
|
|
; CHECK-NEXT: .b8 27 // DW_AT_comp_dir
|
|
|
|
; CHECK-NEXT: .b8 8 // DW_FORM_string
|
|
|
|
; CHECK-NEXT: .b8 17 // DW_AT_low_pc
|
|
|
|
; CHECK-NEXT: .b8 1 // DW_FORM_addr
|
|
|
|
; CHECK-NEXT: .b8 18 // DW_AT_high_pc
|
|
|
|
; CHECK-NEXT: .b8 1 // DW_FORM_addr
|
|
|
|
; CHECK-NEXT: .b8 0 // EOM(1)
|
|
|
|
; CHECK-NEXT: .b8 0 // EOM(2)
|
|
|
|
; CHECK-NEXT: .b8 0 // EOM(3)
|
|
|
|
; CHECK-NEXT: }
|
|
|
|
; CHECK-NEXT: .section .debug_info
|
|
|
|
; CHECK-NEXT: {
|
|
|
|
; CHECK-NEXT: .b32 50 // Length of Unit
|
|
|
|
; CHECK-NEXT: .b8 2 // DWARF version number
|
|
|
|
; CHECK-NEXT: .b8 0
|
|
|
|
; CHECK-NEXT: .b32 .debug_abbrev // Offset Into Abbrev. Section
|
|
|
|
; CHECK-NEXT: .b8 8 // Address Size (in bytes)
|
|
|
|
; CHECK-NEXT: .b8 1 // Abbrev [1] 0xb:0x2b DW_TAG_compile_unit
|
|
|
|
; CHECK-NEXT: .b8 0 // DW_AT_producer
|
|
|
|
; CHECK-NEXT: .b8 4 // DW_AT_language
|
|
|
|
; CHECK-NEXT: .b8 0
|
2019-03-09 05:29:17 +08:00
|
|
|
; CHECK-NEXT: .b8 98 // DW_AT_name
|
|
|
|
; CHECK-NEXT: .b8 97
|
|
|
|
; CHECK-NEXT: .b8 114
|
|
|
|
; CHECK-NEXT: .b8 46
|
|
|
|
; CHECK-NEXT: .b8 99
|
|
|
|
; CHECK-NEXT: .b8 117
|
2019-01-24 02:59:54 +08:00
|
|
|
; CHECK-NEXT: .b8 0
|
|
|
|
; CHECK-NEXT: .b32 .debug_line // DW_AT_stmt_list
|
2019-03-09 05:29:17 +08:00
|
|
|
; CHECK-NEXT: .b8 47 // DW_AT_comp_dir
|
|
|
|
; CHECK-NEXT: .b8 115
|
|
|
|
; CHECK-NEXT: .b8 111
|
|
|
|
; CHECK-NEXT: .b8 117
|
|
|
|
; CHECK-NEXT: .b8 114
|
|
|
|
; CHECK-NEXT: .b8 99
|
|
|
|
; CHECK-NEXT: .b8 101
|
|
|
|
; CHECK-NEXT: .b8 47
|
|
|
|
; CHECK-NEXT: .b8 100
|
|
|
|
; CHECK-NEXT: .b8 105
|
|
|
|
; CHECK-NEXT: .b8 114
|
2019-01-24 02:59:54 +08:00
|
|
|
; CHECK-NEXT: .b8 0
|
|
|
|
; CHECK-NEXT: .b64 Lfunc_begin0 // DW_AT_low_pc
|
|
|
|
; CHECK-NEXT: .b64 Lfunc_end1 // DW_AT_high_pc
|
|
|
|
; CHECK-NEXT: }
|
2019-11-09 07:26:17 +08:00
|
|
|
; CHECK-NEXT: .section .debug_loc { }
|
|
|
|
; CHECK-NOT: debug_
|
2018-05-18 11:13:08 +08:00
|
|
|
|
2016-02-12 02:21:47 +08:00
|
|
|
!llvm.dbg.cu = !{!0}
|
|
|
|
!llvm.module.flags = !{!8, !9}
|
|
|
|
|
2016-04-15 23:57:41 +08:00
|
|
|
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "", isOptimized: false, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2)
|
2016-02-12 02:21:47 +08:00
|
|
|
!1 = !DIFile(filename: "bar.cu", directory: "/source/dir")
|
|
|
|
!2 = !{}
|
[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
|
|
|
!4 = distinct !DISubprogram(name: "foo", scope: !5, file: !5, line: 1, type: !6, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
|
2016-02-12 02:21:47 +08:00
|
|
|
!5 = !DIFile(filename: "foo.h", directory: "/source/dir")
|
|
|
|
!6 = !DISubroutineType(types: !2)
|
[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
|
|
|
!7 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 2, type: !6, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
|
2018-05-18 11:13:08 +08:00
|
|
|
!8 = !{i32 2, !"Dwarf Version", i32 2}
|
2016-02-12 02:21:47 +08:00
|
|
|
!9 = !{i32 2, !"Debug Info Version", i32 3}
|
|
|
|
!10 = !DILocation(line: 1, column: 31, scope: !4)
|
|
|
|
!11 = !DILocation(line: 2, column: 31, scope: !7)
|