Home | History | Annotate | Download | only in RISCV
      1 ; RUN: llc -filetype=obj -mtriple=riscv32 -mattr=+relax %s -o - \
      2 ; RUN:     | llvm-readobj -r | FileCheck -check-prefix=RELAX %s
      3 ;
      4 ; RELAX: .rela.debug_line {
      5 ; RELAX: R_RISCV_ADD16
      6 ; RELAX: R_RISCV_SUB16
      7 source_filename = "line.c"
      8 
      9 ; Function Attrs: noinline nounwind optnone
     10 define i32 @init() !dbg !7 {
     11 entry:
     12   ret i32 0, !dbg !11
     13 }
     14 
     15 ; Function Attrs: noinline nounwind optnone
     16 define i32 @foo(i32 signext %value) !dbg !12 {
     17 entry:
     18   %value.addr = alloca i32, align 4
     19   store i32 %value, i32* %value.addr, align 4
     20   call void @llvm.dbg.declare(metadata i32* %value.addr, metadata !15, metadata !DIExpression()), !dbg !16
     21   %0 = load i32, i32* %value.addr, align 4, !dbg !17
     22   ret i32 %0, !dbg !18
     23 }
     24 
     25 ; Function Attrs: nounwind readnone speculatable
     26 declare void @llvm.dbg.declare(metadata, metadata, metadata)
     27 
     28 ; Function Attrs: noinline nounwind optnone
     29 define i32 @bar() !dbg !19 {
     30 entry:
     31   %result = alloca i32, align 4
     32   %v = alloca i32, align 4
     33   call void @llvm.dbg.declare(metadata i32* %result, metadata !20, metadata !DIExpression()), !dbg !21
     34   call void @llvm.dbg.declare(metadata i32* %v, metadata !22, metadata !DIExpression()), !dbg !23
     35   %call = call i32 @init(), !dbg !24
     36   store i32 %call, i32* %v, align 4, !dbg !23
     37   %0 = load i32, i32* %v, align 4, !dbg !25
     38   %call1 = call i32 @foo(i32 signext %0), !dbg !26
     39   store i32 %call1, i32* %result, align 4, !dbg !27
     40   %1 = load i32, i32* %result, align 4, !dbg !28
     41   ret i32 %1, !dbg !29
     42 }
     43 
     44 !llvm.dbg.cu = !{!0}
     45 !llvm.module.flags = !{!3, !4, !5}
     46 
     47 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
     48 !1 = !DIFile(filename: "line.c", directory: "./")
     49 !2 = !{}
     50 !3 = !{i32 2, !"Dwarf Version", i32 4}
     51 !4 = !{i32 2, !"Debug Info Version", i32 3}
     52 !5 = !{i32 1, !"wchar_size", i32 4}
     53 !7 = distinct !DISubprogram(name: "init", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 2, isOptimized: false, unit: !0, retainedNodes: !2)
     54 !8 = !DISubroutineType(types: !9)
     55 !9 = !{!10}
     56 !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
     57 !11 = !DILocation(line: 3, column: 3, scope: !7)
     58 !12 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 6, type: !13, isLocal: false, isDefinition: true, scopeLine: 7, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
     59 !13 = !DISubroutineType(types: !14)
     60 !14 = !{!10, !10}
     61 !15 = !DILocalVariable(name: "value", arg: 1, scope: !12, file: !1, line: 6, type: !10)
     62 !16 = !DILocation(line: 6, column: 13, scope: !12)
     63 !17 = !DILocation(line: 8, column: 10, scope: !12)
     64 !18 = !DILocation(line: 8, column: 3, scope: !12)
     65 !19 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 11, type: !8, isLocal: false, isDefinition: true, scopeLine: 12, isOptimized: false, unit: !0, retainedNodes: !2)
     66 !20 = !DILocalVariable(name: "result", scope: !19, file: !1, line: 13, type: !10)
     67 !21 = !DILocation(line: 13, column: 7, scope: !19)
     68 !22 = !DILocalVariable(name: "v", scope: !19, file: !1, line: 14, type: !10)
     69 !23 = !DILocation(line: 14, column: 7, scope: !19)
     70 !24 = !DILocation(line: 14, column: 11, scope: !19)
     71 !25 = !DILocation(line: 16, column: 16, scope: !19)
     72 !26 = !DILocation(line: 16, column: 12, scope: !19)
     73 !27 = !DILocation(line: 16, column: 10, scope: !19)
     74 !28 = !DILocation(line: 18, column: 10, scope: !19)
     75 !29 = !DILocation(line: 18, column: 3, scope: !19)
     76