• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -filetype=obj -mtriple=riscv32 -mattr=+relax %s -o %t.o
2; RUN: llvm-readobj -r %t.o | FileCheck -check-prefix=RELAX %s
3; RUN: llvm-dwarfdump --debug-frame %t.o 2>&1 \
4; RUN:     | FileCheck -check-prefix=RELAX-DWARFDUMP %s
5;
6; RELAX:      Section ({{.*}}) .rela.eh_frame {
7; RELAX-NEXT:   0x1C R_RISCV_32_PCREL - 0x0
8; RELAX-NEXT:   0x20 R_RISCV_ADD32 - 0x0
9; RELAX-NEXT:   0x20 R_RISCV_SUB32 - 0x0
10; RELAX-NOT:  }
11; RELAX:        0x39 R_RISCV_SET6 - 0x0
12; RELAX-NEXT:   0x39 R_RISCV_SUB6 - 0x0
13;
14; RELAX-DWARFDUMP-NOT: error: failed to compute relocation
15; RELAX-DWARFDUMP: CIE
16; RELAX-DWARFDUMP: DW_CFA_advance_loc
17; RELAX-DWARFDUMP: DW_CFA_def_cfa_offset
18; RELAX-DWARFDUMP: DW_CFA_offset
19source_filename = "frame.c"
20
21; Function Attrs: noinline nounwind optnone
22define i32 @init() {
23entry:
24  ret i32 0
25}
26
27; Function Attrs: noinline nounwind optnone
28define i32 @foo(i32 signext %value) {
29entry:
30  %value.addr = alloca i32, align 4
31  store i32 %value, i32* %value.addr, align 4
32  %0 = load i32, i32* %value.addr, align 4
33  ret i32 %0
34}
35
36; Function Attrs: noinline nounwind optnone
37define i32 @bar() {
38entry:
39  %result = alloca i32, align 4
40  %v = alloca i32, align 4
41  %call = call i32 @init()
42  store i32 %call, i32* %v, align 4
43  %0 = load i32, i32* %v, align 4
44  %call1 = call i32 @foo(i32 signext %0)
45  store i32 %call1, i32* %result, align 4
46  %1 = load i32, i32* %result, align 4
47  ret i32 %1
48}
49
50!llvm.dbg.cu = !{!0}
51!llvm.module.flags = !{!3, !4, !5}
52
53!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
54!1 = !DIFile(filename: "line.c", directory: "./")
55!2 = !{}
56!3 = !{i32 2, !"Dwarf Version", i32 4}
57!4 = !{i32 2, !"Debug Info Version", i32 3}
58!5 = !{i32 1, !"wchar_size", i32 4}
59