2018-03-12 15:01:28 +01:00
|
|
|
; RUN: llc -march=hexagon < %s | FileCheck %s
|
|
|
|
|
|
|
|
; This test case is little iffy. It checks for line_table_start,
|
|
|
|
; which in future may be completely replaced with some other label name.
|
|
|
|
; The first check is the use, the second check is for defition.
|
|
|
|
|
|
|
|
; CHECK: .Lline_table_start0
|
|
|
|
; CHECK: .Lline_table_start0:
|
|
|
|
|
|
|
|
; Function Attrs: nounwind
|
|
|
|
define i32 @f0() #0 !dbg !5 {
|
|
|
|
b0:
|
|
|
|
%v0 = alloca i32, align 4
|
|
|
|
store i32 0, i32* %v0, align 4
|
|
|
|
ret i32 0, !dbg !9
|
|
|
|
}
|
|
|
|
|
|
|
|
attributes #0 = { nounwind "target-cpu"="hexagonv55" }
|
|
|
|
|
|
|
|
!llvm.dbg.cu = !{!0}
|
|
|
|
!llvm.module.flags = !{!3, !4}
|
|
|
|
|
|
|
|
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "Clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
|
|
|
|
!1 = !DIFile(filename: "/tmp/1.c", directory: "/tmp")
|
|
|
|
!2 = !{}
|
|
|
|
!3 = !{i32 2, !"Dwarf Version", i32 4}
|
|
|
|
!4 = !{i32 2, !"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 04:40:45 +02:00
|
|
|
!5 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 1, type: !6, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: false, unit: !0, retainedNodes: !2)
|
2018-03-12 15:01:28 +01:00
|
|
|
!6 = !DISubroutineType(types: !7)
|
|
|
|
!7 = !{!8}
|
|
|
|
!8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
|
|
|
|
!9 = !DILocation(line: 2, column: 3, scope: !5)
|