2016-03-26 01:54:46 +08:00
|
|
|
; RUN: llc < %s | FileCheck %s --check-prefix=ASM
|
Re-commit "DWARF location lists: Add section index dumping"
This reapplies c0f6ad7d1f3ccb9d0b9ce9ef8dfa06409ccf1b3e with an
additional fix in test/DebugInfo/X86/constant-loclist.ll, which had a
slightly different output on windows targets. The test now accounts for
this difference.
The original commit message follows.
Summary:
As discussed in D70081, this adds the ability to dump section
names/indices to the location list dumper. It does this by moving the
range specific logic from DWARFDie.cpp:dumpRanges into the
DWARFAddressRange class.
The trickiest part of this patch is the backflip in the meanings of the
two dump flags for the location list sections.
The dumping of "raw" location list data is now controlled by
"DisplayRawContents" flag. This frees up the "Verbose" flag to be used
to control whether we print the section index. Additionally, the
DisplayRawContents flag is set for section-based dumps whenever the
--verbose option is passed, but this is not done for the "inline" dumps.
Also note that the index dumping currently does not work for the DWARF
v5 location lists, as the parser does not fill out the appropriate
fields. This will be done in a separate patch.
Reviewers: dblaikie, probinson, JDevlieghere, SouraVX
Subscribers: sdardis, hiraditya, jrtc27, atanasyan, arphaman, aprantl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70227
2019-11-14 18:22:00 +08:00
|
|
|
; RUN: llc < %s -filetype=obj | llvm-dwarfdump - | FileCheck %s --check-prefix=DWARF
|
2016-03-26 01:54:46 +08:00
|
|
|
|
|
|
|
; Values in registers should be clobbered by calls, which use a regmask instead
|
|
|
|
; of individual register def operands.
|
|
|
|
|
|
|
|
; ASM: main: # @main
|
2018-02-01 06:04:26 +08:00
|
|
|
; ASM: #DEBUG_VALUE: main:argc <- $ecx
|
2016-03-26 01:54:46 +08:00
|
|
|
; ASM: movl $1, x(%rip)
|
|
|
|
; ASM: callq clobber
|
|
|
|
; ASM-NEXT: [[argc_range_end:.Ltmp[0-9]+]]:
|
2017-11-29 01:15:09 +08:00
|
|
|
; Previously LiveDebugValues would claim argc was still in ecx after the call.
|
2016-03-26 01:54:46 +08:00
|
|
|
; ASM-NOT: #DEBUG_VALUE: main:argc
|
|
|
|
|
|
|
|
; argc is the first debug location.
|
|
|
|
; ASM: .Ldebug_loc1:
|
|
|
|
; ASM-NEXT: .quad .Lfunc_begin0-.Lfunc_begin0
|
|
|
|
; ASM-NEXT: .quad [[argc_range_end]]-.Lfunc_begin0
|
2017-03-17 01:14:56 +08:00
|
|
|
; ASM-NEXT: .short 1 # Loc expr size
|
2016-03-26 01:54:46 +08:00
|
|
|
; ASM-NEXT: .byte 82 # super-register DW_OP_reg2
|
|
|
|
|
|
|
|
; argc is the first formal parameter.
|
|
|
|
; DWARF: .debug_info contents:
|
|
|
|
; DWARF: DW_TAG_formal_parameter
|
Re-commit "DWARF location lists: Add section index dumping"
This reapplies c0f6ad7d1f3ccb9d0b9ce9ef8dfa06409ccf1b3e with an
additional fix in test/DebugInfo/X86/constant-loclist.ll, which had a
slightly different output on windows targets. The test now accounts for
this difference.
The original commit message follows.
Summary:
As discussed in D70081, this adds the ability to dump section
names/indices to the location list dumper. It does this by moving the
range specific logic from DWARFDie.cpp:dumpRanges into the
DWARFAddressRange class.
The trickiest part of this patch is the backflip in the meanings of the
two dump flags for the location list sections.
The dumping of "raw" location list data is now controlled by
"DisplayRawContents" flag. This frees up the "Verbose" flag to be used
to control whether we print the section index. Additionally, the
DisplayRawContents flag is set for section-based dumps whenever the
--verbose option is passed, but this is not done for the "inline" dumps.
Also note that the index dumping currently does not work for the DWARF
v5 location lists, as the parser does not fill out the appropriate
fields. This will be done in a separate patch.
Reviewers: dblaikie, probinson, JDevlieghere, SouraVX
Subscribers: sdardis, hiraditya, jrtc27, atanasyan, arphaman, aprantl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70227
2019-11-14 18:22:00 +08:00
|
|
|
; DWARF-NEXT: DW_AT_location ({{0x.*}}
|
2018-01-16 19:17:57 +08:00
|
|
|
; DWARF-NEXT: [0x0000000000000000, 0x0000000000000013): DW_OP_reg2 RCX)
|
Re-commit "DWARF location lists: Add section index dumping"
This reapplies c0f6ad7d1f3ccb9d0b9ce9ef8dfa06409ccf1b3e with an
additional fix in test/DebugInfo/X86/constant-loclist.ll, which had a
slightly different output on windows targets. The test now accounts for
this difference.
The original commit message follows.
Summary:
As discussed in D70081, this adds the ability to dump section
names/indices to the location list dumper. It does this by moving the
range specific logic from DWARFDie.cpp:dumpRanges into the
DWARFAddressRange class.
The trickiest part of this patch is the backflip in the meanings of the
two dump flags for the location list sections.
The dumping of "raw" location list data is now controlled by
"DisplayRawContents" flag. This frees up the "Verbose" flag to be used
to control whether we print the section index. Additionally, the
DisplayRawContents flag is set for section-based dumps whenever the
--verbose option is passed, but this is not done for the "inline" dumps.
Also note that the index dumping currently does not work for the DWARF
v5 location lists, as the parser does not fill out the appropriate
fields. This will be done in a separate patch.
Reviewers: dblaikie, probinson, JDevlieghere, SouraVX
Subscribers: sdardis, hiraditya, jrtc27, atanasyan, arphaman, aprantl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70227
2019-11-14 18:22:00 +08:00
|
|
|
; DWARF-NEXT: DW_AT_name ("argc")
|
2016-03-26 01:54:46 +08:00
|
|
|
|
|
|
|
; ModuleID = 't.cpp'
|
2016-12-22 08:45:21 +08:00
|
|
|
source_filename = "test/DebugInfo/X86/dbg-value-regmask-clobber.ll"
|
2016-03-26 01:54:46 +08:00
|
|
|
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
|
|
|
|
target triple = "x86_64-pc-windows-msvc18.0.0"
|
|
|
|
|
2016-12-22 08:45:21 +08:00
|
|
|
@x = common global i32 0, align 4, !dbg !0
|
2016-03-26 01:54:46 +08:00
|
|
|
|
|
|
|
; Function Attrs: nounwind uwtable
|
2016-12-22 08:45:21 +08:00
|
|
|
define i32 @main(i32 %argc, i8** nocapture readnone %argv) #0 !dbg !12 {
|
2016-03-26 01:54:46 +08:00
|
|
|
entry:
|
2017-07-29 04:21:02 +08:00
|
|
|
tail call void @llvm.dbg.value(metadata i8** %argv, metadata !19, metadata !21), !dbg !22
|
|
|
|
tail call void @llvm.dbg.value(metadata i32 %argc, metadata !20, metadata !21), !dbg !23
|
2016-03-26 01:54:46 +08:00
|
|
|
store volatile i32 1, i32* @x, align 4, !dbg !24, !tbaa !25
|
2016-12-22 08:45:21 +08:00
|
|
|
tail call void @clobber() #2, !dbg !29
|
2016-03-26 01:54:46 +08:00
|
|
|
store volatile i32 2, i32* @x, align 4, !dbg !30, !tbaa !25
|
|
|
|
%0 = load volatile i32, i32* @x, align 4, !dbg !31, !tbaa !25
|
|
|
|
%tobool = icmp eq i32 %0, 0, !dbg !31
|
|
|
|
br i1 %tobool, label %if.else, label %if.then, !dbg !33
|
|
|
|
|
|
|
|
if.then: ; preds = %entry
|
|
|
|
store volatile i32 3, i32* @x, align 4, !dbg !34, !tbaa !25
|
|
|
|
br label %if.end, !dbg !36
|
|
|
|
|
|
|
|
if.else: ; preds = %entry
|
2016-12-22 08:45:21 +08:00
|
|
|
|
2016-03-26 01:54:46 +08:00
|
|
|
store volatile i32 4, i32* @x, align 4, !dbg !37, !tbaa !25
|
|
|
|
br label %if.end
|
|
|
|
|
|
|
|
if.end: ; preds = %if.else, %if.then
|
|
|
|
ret i32 0, !dbg !39
|
|
|
|
}
|
|
|
|
|
|
|
|
declare void @clobber()
|
|
|
|
|
|
|
|
; Function Attrs: nounwind readnone
|
2017-07-29 04:21:02 +08:00
|
|
|
declare void @llvm.dbg.value(metadata, metadata, metadata) #1
|
2016-03-26 01:54:46 +08:00
|
|
|
|
|
|
|
attributes #0 = { nounwind uwtable }
|
2016-12-22 08:45:21 +08:00
|
|
|
attributes #1 = { nounwind readnone }
|
|
|
|
attributes #2 = { nounwind }
|
|
|
|
|
|
|
|
!llvm.dbg.cu = !{!2}
|
|
|
|
!llvm.module.flags = !{!8, !9, !10}
|
|
|
|
!llvm.ident = !{!11}
|
|
|
|
|
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: "x", scope: !2, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true)
|
|
|
|
!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 3.9.0 (trunk 260617) (llvm/trunk 260619)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5)
|
|
|
|
!3 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cbuild")
|
|
|
|
!4 = !{}
|
|
|
|
!5 = !{!0}
|
|
|
|
!6 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !7)
|
2016-03-26 01:54:46 +08:00
|
|
|
!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
|
2016-12-22 08:45:21 +08:00
|
|
|
!8 = !{i32 2, !"Dwarf Version", i32 4}
|
|
|
|
!9 = !{i32 2, !"Debug Info Version", i32 3}
|
|
|
|
!10 = !{i32 1, !"PIC Level", i32 2}
|
|
|
|
!11 = !{!"clang version 3.9.0 (trunk 260617) (llvm/trunk 260619)"}
|
[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
|
|
|
!12 = distinct !DISubprogram(name: "main", scope: !3, file: !3, line: 4, type: !13, isLocal: false, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: true, unit: !2, retainedNodes: !18)
|
2016-12-22 08:45:21 +08:00
|
|
|
!13 = !DISubroutineType(types: !14)
|
|
|
|
!14 = !{!7, !7, !15}
|
|
|
|
!15 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !16, size: 64, align: 64)
|
|
|
|
!16 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !17, size: 64, align: 64)
|
|
|
|
!17 = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
|
|
|
|
!18 = !{!19, !20}
|
|
|
|
!19 = !DILocalVariable(name: "argv", arg: 2, scope: !12, file: !3, line: 4, type: !15)
|
|
|
|
!20 = !DILocalVariable(name: "argc", arg: 1, scope: !12, file: !3, line: 4, type: !7)
|
2016-03-26 01:54:46 +08:00
|
|
|
!21 = !DIExpression()
|
2016-12-22 08:45:21 +08:00
|
|
|
!22 = !DILocation(line: 4, column: 27, scope: !12)
|
|
|
|
!23 = !DILocation(line: 4, column: 14, scope: !12)
|
|
|
|
!24 = !DILocation(line: 5, column: 5, scope: !12)
|
2016-03-26 01:54:46 +08:00
|
|
|
!25 = !{!26, !26, i64 0}
|
|
|
|
!26 = !{!"int", !27, i64 0}
|
|
|
|
!27 = !{!"omnipotent char", !28, i64 0}
|
|
|
|
!28 = !{!"Simple C/C++ TBAA"}
|
2016-12-22 08:45:21 +08:00
|
|
|
!29 = !DILocation(line: 6, column: 3, scope: !12)
|
|
|
|
!30 = !DILocation(line: 7, column: 5, scope: !12)
|
2016-03-26 01:54:46 +08:00
|
|
|
!31 = !DILocation(line: 8, column: 7, scope: !32)
|
2016-12-22 08:45:21 +08:00
|
|
|
!32 = distinct !DILexicalBlock(scope: !12, file: !3, line: 8, column: 7)
|
|
|
|
!33 = !DILocation(line: 8, column: 7, scope: !12)
|
2016-03-26 01:54:46 +08:00
|
|
|
!34 = !DILocation(line: 9, column: 7, scope: !35)
|
2016-12-22 08:45:21 +08:00
|
|
|
!35 = distinct !DILexicalBlock(scope: !32, file: !3, line: 8, column: 10)
|
2016-03-26 01:54:46 +08:00
|
|
|
!36 = !DILocation(line: 10, column: 3, scope: !35)
|
|
|
|
!37 = !DILocation(line: 11, column: 7, scope: !38)
|
2016-12-22 08:45:21 +08:00
|
|
|
!38 = distinct !DILexicalBlock(scope: !32, file: !3, line: 10, column: 10)
|
|
|
|
!39 = !DILocation(line: 13, column: 1, scope: !12)
|
|
|
|
|