Home | History | Annotate | Download | only in X86
      1 # RUN: llc -verify-machineinstrs -start-after=prologepilog -filetype=obj -o - %s | llvm-dwarfdump -v --debug-info - | FileCheck %s
      2 # CHECK: .debug_info contents:
      3 # CHECK: DW_TAG_variable
      4 # CHECK-NEXT: DW_AT_location {{.*}}         (DW_OP_reg1 RDX, DW_OP_bit_piece 0x8 0x8)
      5 # CHECK-NEXT: DW_AT_name {{.*}}"dh"
      6 --- |
      7   ; Manually created after:
      8   ; char f(int i) {
      9   ;   char dh = i>>8;
     10   ;   return dh;
     11   ; }
     12 
     13   target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
     14   target triple = "x86_64-apple-macosx10.12.0"
     15   
     16   define signext i8 @f(i32 %i) local_unnamed_addr #0 !dbg !7 {
     17   entry:
     18     tail call void @llvm.dbg.value(metadata i32 %i, i64 0, metadata !13, metadata !15), !dbg !16
     19     %shr1 = lshr i32 %i, 8, !dbg !17
     20     %conv = trunc i32 %shr1 to i8, !dbg !18
     21     tail call void @llvm.dbg.value(metadata i8 %conv, i64 0, metadata !14, metadata !15), !dbg !19
     22     ret i8 %conv, !dbg !20
     23   }
     24   
     25   declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #0
     26   
     27   attributes #0 = { nounwind readnone }
     28   
     29   !llvm.dbg.cu = !{!0}
     30   !llvm.module.flags = !{!3, !4, !5}
     31   !llvm.ident = !{!6}
     32   
     33   !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 4.0.0 (trunk 288677) (llvm/trunk 288679)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
     34   !1 = !DIFile(filename: "t.c", directory: "/")
     35   !2 = !{}
     36   !3 = !{i32 2, !"Dwarf Version", i32 4}
     37   !4 = !{i32 2, !"Debug Info Version", i32 3}
     38   !5 = !{i32 1, !"PIC Level", i32 2}
     39   !6 = !{!"clang version 4.0.0 (trunk 288677) (llvm/trunk 288679)"}
     40   !7 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !12)
     41   !8 = !DISubroutineType(types: !9)
     42   !9 = !{!10, !11}
     43   !10 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
     44   !11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
     45   !12 = !{!13, !14}
     46   !13 = !DILocalVariable(name: "i", arg: 1, scope: !7, file: !1, line: 1, type: !11)
     47   !14 = !DILocalVariable(name: "dh", scope: !7, file: !1, line: 2, type: !10)
     48   !15 = !DIExpression()
     49   !16 = !DILocation(line: 1, column: 12, scope: !7)
     50   !17 = !DILocation(line: 2, column: 14, scope: !7)
     51   !18 = !DILocation(line: 2, column: 13, scope: !7)
     52   !19 = !DILocation(line: 2, column: 8, scope: !7)
     53   !20 = !DILocation(line: 3, column: 3, scope: !7)
     54 
     55 ...
     56 ---
     57 name:            f
     58 alignment:       4
     59 exposesReturnsTwice: false
     60 legalized:       false
     61 regBankSelected: false
     62 selected:        false
     63 tracksRegLiveness: true
     64 liveins:         
     65   - { reg: '$edi' }
     66 frameInfo:       
     67   isFrameAddressTaken: false
     68   isReturnAddressTaken: false
     69   hasStackMap:     false
     70   hasPatchPoint:   false
     71   stackSize:       8
     72   offsetAdjustment: 0
     73   maxAlignment:    0
     74   adjustsStack:    false
     75   hasCalls:        false
     76   maxCallFrameSize: 0
     77   hasOpaqueSPAdjustment: false
     78   hasVAStart:      false
     79   hasMustTailInVarArgFunc: false
     80 fixedStack:      
     81   - { id: 0, type: spill-slot, offset: -16, size: 8, alignment: 16 }
     82 body:             |
     83   bb.0.entry:
     84     liveins: $edi, $rbp
     85   
     86     frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp
     87     CFI_INSTRUCTION def_cfa_offset 16
     88     CFI_INSTRUCTION offset $rbp, -16
     89     $rbp = frame-setup MOV64rr $rsp
     90     CFI_INSTRUCTION def_cfa_register $rbp
     91     DBG_VALUE debug-use $dh, debug-use _, !14, !15, debug-location !16
     92     $edi = SHR32ri killed $edi, 8, implicit-def dead $eflags, debug-location !17
     93     $eax = MOVSX32rr8 $dil, implicit killed $edi, debug-location !20
     94     $rbp = POP64r implicit-def $rsp, implicit $rsp, debug-location !20
     95     RETQ $eax, debug-location !20
     96 
     97 ...
     98