brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.9 KiB · d412f9f Raw
93 lines · plain
1# RUN: llc %s --start-after=livedebugvalues -filetype=obj -o - \2# RUN:     | llvm-dwarfdump - -name local* -regex \3# RUN:     | FileCheck %s4#5## This tests certain single location detection functionality. The Test MIR6## is hand written. Test directives and comments inline.7 8--- |9  target triple = "x86_64-unknown-linux-gnu"10  define dso_local i32 @fun() local_unnamed_addr !dbg !7 {11  entry:12    ret i32 013  }14 15  !llvm.dbg.cu = !{!0}16  !llvm.module.flags = !{!3, !4, !5}17  !llvm.ident = !{!6}18 19  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 11.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)20  !1 = !DIFile(filename: "example.c", directory: "/")21  !3 = !{i32 7, !"Dwarf Version", i32 4}22  !4 = !{i32 2, !"Debug Info Version", i32 3}23  !5 = !{i32 1, !"wchar_size", i32 4}24  !6 = !{!"clang version 11.0.0"}25  !8 = !DISubroutineType(types: !9)26  !9 = !{!10}27  !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)28  !22 = !DISubroutineType(types: !23)29  !23 = !{!10, !10}30  ; --- Important metadata ---31  !7 = distinct !DISubprogram(name: "fun", scope: !1, file: !1, line: 2, type: !8, scopeLine: 2, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0)32  !24 = distinct !DILexicalBlock(scope: !7, file: !1, line: 9, column: 3)33  !14 = distinct !DILexicalBlock(scope: !7, file: !1, line: 4, column: 3)34  !12 = !DILocalVariable(name: "locala", scope: !7, file: !1, line: 1, type: !10)35  !13 = !DILocalVariable(name: "localb", scope: !14, file: !1, line: 2, type: !10)36  !25 = !DILocalVariable(name: "localc", scope: !24, file: !1, line: 3, type: !10)37  !27 = !DILocalVariable(name: "tmp",    scope: !14, file: !1, line: 2, type: !10)38  !15 = !DILocation(line: 1, column: 0, scope: !7)39  !18 = !DILocation(line: 2, column: 1, scope: !14)40  !26 = !DILocation(line: 3, column: 1, scope: !24)41...42---43name:            fun44body:             |45  bb.0.entry:46    ;; This is the scope and variable structure:47    ;; int fun() {       // scope fun !748    ;;   int locala;     // scope fun !7,        var locala !12, debug-location !1549    ;;   { int localb;   // scope fun:block !14, var localb !13, debug-location !1850    ;;     int tmp;    } // scope fun:block !14, var localb !27, debug-location !1851    ;;   { int localc; } // scope fun:block !24, var localc !25, debug-location !2652    ;; }53    ;;54    ;; (1) Check that frame-setup instructions are not counted against55    ;;     locations being valid throughout the function call.56    ;57    ; CHECK:      DW_TAG_variable58    ; CHECK-NEXT:   DW_AT_location (DW_OP_reg5 RDI)59    ; CHECK-NEXT:   DW_AT_name ("locala")60    $rbp = frame-setup MOV64rr $rsp61    DBG_VALUE $edi, $noreg, !12, !DIExpression(), debug-location !1562    $eax = MOV32ri 0, debug-location !1563 64    ;; (2) The scope block ends with a meta instruction. A location range ends65    ;;     with the final non-meta instruction in the scope. Check that66    ;;     location is considered valid throughout.67    ;68    ; CHECK:      DW_TAG_variable69    ; CHECK-NEXT:   DW_AT_location (DW_OP_reg2 RCX)70    ; CHECK-NEXT:   DW_AT_name ("localb")71    ;72    ;; start scope, start location range73    DBG_VALUE $ecx, $noreg, !13, !DIExpression(), debug-location !1874    ;; end location range75    $ecx = MOV32ri 1, debug-location !1876    ;; end scope77    DBG_VALUE $noreg, $noreg, !27, !DIExpression(), debug-location !1878 79    ;; (3) The final instruction in the scope closes a location range. Check80    ;;     that location is considered valid throughout.81    ;82    ; CHECK:      DW_TAG_variable83    ; CHECK-NEXT:   DW_AT_location (DW_OP_reg4 RSI)84    ; CHECK-NEXT:   DW_AT_name ("localc")85    ;86    ;; start scope, start location range87    DBG_VALUE $esi, $noreg, !25, !DIExpression(), debug-location !2688    ;; end scope, end location range89    $esi = MOV32ri 2, debug-location !2690 91    RET64 debug-location !1592...93