xref: /llvm-project/llvm/test/CodeGen/LoongArch/xray-attribute-instrumentation.ll (revision 9d4f7f44b64d87d1068859906f43b7ce03a7388b)
1; RUN: llc --mtriple=loongarch64 -mattr=+d %s -o - | FileCheck %s
2; RUN: llc --mtriple=loongarch64 -mattr=+d -filetype=obj %s -o %t
3; RUN: llvm-readobj -r %t | FileCheck %s --check-prefix=RELOC
4
5define i32 @foo() nounwind noinline uwtable "function-instrument"="xray-always" {
6; CHECK-LABEL: foo:
7; CHECK-LABEL: .Lfunc_begin0:
8; CHECK:       .p2align 2
9; CHECK-LABEL: .Lxray_sled_begin0:
10; CHECK-NEXT:  b .Lxray_sled_end0
11; CHECK-COUNT-11:  nop
12; CHECK-LABEL: .Lxray_sled_end0:
13  ret i32 0
14; CHECK-LABEL: .Lxray_sled_begin1:
15; CHECK-NEXT:  b .Lxray_sled_end1
16; CHECK-COUNT-11:  nop
17; CHECK-NEXT: .Lxray_sled_end1:
18; CHECK-NEXT:  ret
19; CHECK-NEXT: .Lfunc_end0:
20}
21
22; CHECK-LABEL: .section xray_instr_map
23; CHECK-NEXT: .Lxray_sleds_start0:
24; CHECK-NEXT: [[TMP:.Ltmp[0-9]+]]:
25; CHECK-NEXT: .dword .Lxray_sled_begin0-[[TMP]]
26; CHECK-NEXT: .dword .Lfunc_begin0-([[TMP]]+8)
27; CHECK-NEXT: .byte 0x00
28; CHECK-NEXT: .byte 0x01
29; CHECK-NEXT: .byte 0x02
30; CHECK-NEXT: .space 13
31; CHECK-NEXT: [[TMP:.Ltmp[0-9]+]]:
32; CHECK-NEXT: .dword .Lxray_sled_begin1-[[TMP]]
33; CHECK-NEXT: .dword .Lfunc_begin0-([[TMP]]+8)
34; CHECK-NEXT: .byte 0x01
35; CHECK-NEXT: .byte 0x01
36; CHECK-NEXT: .byte 0x02
37; CHECK-NEXT: .space 13
38; CHECK-NEXT: .Lxray_sleds_end0:
39
40; CHECK-LABEL:  .section xray_fn_idx
41; CHECK:      [[IDX:.Lxray_fn_idx[0-9]+]]:
42; CHECK:      .dword .Lxray_sleds_start0-[[IDX]]
43; CHECK-NEXT: .dword 2
44
45; RELOC:      Section ([[#]]) .relaxray_instr_map {
46; RELOC-NEXT:   0x0 R_LARCH_64_PCREL .text 0x0
47; RELOC-NEXT:   0x8 R_LARCH_64_PCREL .text 0x0
48; RELOC-NEXT:   0x20 R_LARCH_64_PCREL .text 0x34
49; RELOC-NEXT:   0x28 R_LARCH_64_PCREL .text 0x0
50; RELOC-NEXT: }
51; RELOC-NEXT: Section ([[#]]) .relaxray_fn_idx {
52; RELOC-NEXT:   0x0 R_LARCH_64_PCREL xray_instr_map 0x0
53; RELOC-NEXT: }
54; RELOC-NEXT: Section ([[#]]) .rela.eh_frame {
55; RELOC-NEXT:   0x1C R_LARCH_32_PCREL .text 0x0
56; RELOC-NEXT: }
57