mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 11:02:59 +02:00
a2029fa58e
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
52 lines
2.4 KiB
LLVM
52 lines
2.4 KiB
LLVM
; RUN: llc -O0 -filetype=asm %s -o - | FileCheck %s
|
|
; Test large integral function arguments passed in multiple registers.
|
|
; CHECK: DEBUG_VALUE: foo:bar <- [DW_OP_LLVM_fragment 64 16] $ax
|
|
; CHECK: DEBUG_VALUE: foo:bar <- [DW_OP_LLVM_fragment 48 16] $r9w
|
|
; CHECK: DEBUG_VALUE: foo:bar <- [DW_OP_LLVM_fragment 32 16] $r10w
|
|
; CHECK: DEBUG_VALUE: foo:bar <- [DW_OP_LLVM_fragment 16 16] $r11w
|
|
; CHECK: DEBUG_VALUE: foo:bar <- [DW_OP_LLVM_fragment 0 16] $bx
|
|
|
|
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
|
|
target triple = "x86_64-unknown-unknown"
|
|
|
|
%rec789 = type { [5 x i16] }
|
|
|
|
define void @foo(%rec789 %bar) !dbg !6 {
|
|
%bar.2 = alloca %rec789, align 1
|
|
call void @llvm.dbg.value(metadata %rec789 %bar, metadata !17, metadata !DIExpression()), !dbg !18
|
|
%1 = extractvalue %rec789 %bar, 0
|
|
%.repack = getelementptr inbounds %rec789, %rec789* %bar.2, i16 0, i32 0, i16 0
|
|
%.elt = extractvalue [5 x i16] %1, 0
|
|
store i16 %.elt, i16* %.repack, align 1
|
|
ret void, !dbg !19
|
|
}
|
|
|
|
; Function Attrs: nounwind readnone speculatable
|
|
declare void @llvm.dbg.value(metadata, metadata, metadata) #6
|
|
|
|
!llvm.dbg.cu = !{!0}
|
|
!llvm.module.flags = !{!3, !4}
|
|
!llvm.ident = !{!5}
|
|
|
|
!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2, globals: !2)
|
|
!1 = !DIFile(filename: "a.c", directory: "b")
|
|
!2 = !{}
|
|
!3 = !{i32 2, !"Dwarf Version", i32 4}
|
|
!4 = !{i32 2, !"Debug Info Version", i32 3}
|
|
!5 = !{!""}
|
|
!6 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 13, type: !7, isLocal: false, isDefinition: true, scopeLine: 14, isOptimized: false, unit: !0, retainedNodes: !2)
|
|
!7 = !DISubroutineType(types: !8)
|
|
!8 = !{!9, !9}
|
|
!9 = !DIDerivedType(tag: DW_TAG_typedef, name: "MyStruct", file: !1, line: 11, baseType: !10)
|
|
!10 = !DICompositeType(tag: DW_TAG_structure_type, file: !1, line: 9, size: 80, elements: !11)
|
|
!11 = !{!12}
|
|
!12 = !DIDerivedType(tag: DW_TAG_member, name: "Array", scope: !10, file: !1, line: 10, baseType: !13, size: 80)
|
|
!13 = !DICompositeType(tag: DW_TAG_array_type, baseType: !14, size: 80, elements: !15)
|
|
!14 = !DIBasicType(name: "int", size: 16, encoding: DW_ATE_signed)
|
|
!15 = !{!16}
|
|
!16 = !DISubrange(count: 5)
|
|
!17 = !DILocalVariable(name: "bar", arg: 1, scope: !6, line: 13, type: !9)
|
|
!18 = !DILocation(line: 13, column: 23, scope: !6)
|
|
!19 = !DILocation(line: 15, column: 5, scope: !6)
|
|
!20 = !DILocation(line: 16, column: 1, scope: !6)
|