2015-05-13 16:58:03 +08:00
|
|
|
; RUN: llc -filetype=asm -asm-verbose=0 < %s | FileCheck %s
|
|
|
|
|
|
|
|
; char ch;
|
|
|
|
; int b;
|
|
|
|
;
|
|
|
|
; void proc (void)
|
|
|
|
; {
|
|
|
|
; ch = 'A';
|
|
|
|
; b = 0; // <== this should have correct location
|
|
|
|
; }
|
|
|
|
|
|
|
|
; CHECK: .loc 1 7 7
|
|
|
|
; CHECK: mov r{{[0-9]}}, #0
|
|
|
|
|
2016-12-22 08:45:21 +08:00
|
|
|
source_filename = "test/DebugInfo/ARM/multiple-constant-uses-drops-dbgloc.ll"
|
2015-05-13 16:58:03 +08:00
|
|
|
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
|
|
|
|
target triple = "armv7--linux-gnueabihf"
|
|
|
|
|
2016-12-22 08:45:21 +08:00
|
|
|
@ch = common global i8 0, align 1, !dbg !0
|
|
|
|
@b = common global i32 0, align 4, !dbg !5
|
2015-05-13 16:58:03 +08:00
|
|
|
|
|
|
|
; Function Attrs: nounwind
|
2016-12-22 08:45:21 +08:00
|
|
|
define void @proc() #0 !dbg !13 {
|
2015-05-13 16:58:03 +08:00
|
|
|
entry:
|
|
|
|
store i8 65, i8* @ch, align 1, !dbg !17
|
|
|
|
store i32 0, i32* @b, align 4, !dbg !18
|
|
|
|
ret void, !dbg !19
|
|
|
|
}
|
|
|
|
|
|
|
|
attributes #0 = { nounwind "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" "target-cpu"="cortex-a8" "target-features"="+neon,+vfp3" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
|
|
|
|
2016-12-22 08:45:21 +08:00
|
|
|
!llvm.dbg.cu = !{!2}
|
|
|
|
!llvm.module.flags = !{!8, !9, !10, !11}
|
|
|
|
!llvm.ident = !{!12}
|
|
|
|
|
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: "ch", scope: !2, file: !3, line: 1, type: !4, isLocal: false, isDefinition: true)
|
|
|
|
!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
|
|
|
|
!3 = !DIFile(filename: "test.c", directory: "/home/user/clang/build")
|
|
|
|
!4 = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_unsigned_char)
|
2017-08-31 02:06:51 +08:00
|
|
|
!5 = !DIGlobalVariableExpression(var: !6, expr: !DIExpression())
|
2016-12-22 08:45:21 +08:00
|
|
|
!6 = !DIGlobalVariable(name: "b", scope: !2, file: !3, line: 2, type: !7, isLocal: false, isDefinition: true)
|
|
|
|
!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
|
|
|
|
!8 = !{i32 2, !"Dwarf Version", i32 4}
|
|
|
|
!9 = !{i32 2, !"Debug Info Version", i32 3}
|
|
|
|
!10 = !{i32 1, !"wchar_size", i32 4}
|
|
|
|
!11 = !{i32 1, !"min_enum_size", i32 4}
|
|
|
|
!12 = !{!"clang version 3.7.0 (http://llvm.org/git/clang.git 9b0abb9df531ef7928c8182120e1869affca17d5) (http://llvm.org/git/llvm.git b1e759524dd94f7ce1e24935daed8383927e96c1)"}
|
[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
|
|
|
!13 = distinct !DISubprogram(name: "proc", scope: !3, file: !3, line: 4, type: !14, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: false, unit: !2, retainedNodes: !16)
|
2016-12-22 08:45:21 +08:00
|
|
|
!14 = !DISubroutineType(types: !15)
|
|
|
|
!15 = !{null}
|
|
|
|
!16 = !{}
|
|
|
|
!17 = !DILocation(line: 6, column: 8, scope: !13)
|
|
|
|
!18 = !DILocation(line: 7, column: 7, scope: !13)
|
|
|
|
!19 = !DILocation(line: 8, column: 1, scope: !13)
|
|
|
|
|