brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · f876544 Raw
66 lines · plain
1/// Test that annotations are properly carried over to fixed calls.2/// Note that --enable-bat is used to force offsets to be kept.3 4// RUN: llvm-mc -triple riscv64 -mattr=+c -filetype obj -o %t.o %s5// RUN: ld.lld --emit-relocs -o %t %t.o6// RUN: llvm-bolt --enable-bat --print-cfg --print-fix-riscv-calls \7// RUN:     -o %t.null %t | FileCheck %s8 9  .text10  .option norvc11  .global f12  .p2align 113f:14  ret15  .size f, .-f16 17// CHECK-LABEL: Binary Function "_start" after building cfg {18// CHECK:      auipc ra, f19// CHECK-NEXT: jalr -0x4(ra) # Offset: 420// CHECK-NEXT: jal f # Offset: 821// CHECK-NEXT: j f # TAILCALL  # Offset: 1222 23// CHECK-LABEL: Binary Function "long_tail" after building cfg {24// CHECK:      auipc t1, f25// CHECK-NEXT: jr -0x18(t1) # TAILCALL  # Offset: 826 27// CHECK-LABEL: Binary Function "compressed_tail" after building cfg {28// CHECK:      jr a0 # TAILCALL  # Offset: 029 30// CHECK-LABEL: Binary Function "_start" after fix-riscv-calls {31// CHECK:      call f # Offset: 032// CHECK-NEXT: call f # Offset: 833// CHECK-NEXT: tail f # TAILCALL   # Offset: 1234 35// CHECK-LABEL: Binary Function "long_tail" after fix-riscv-calls {36// CHECK:      tail f # TAILCALL   # Offset: 437 38// CHECK-LABEL: Binary Function "compressed_tail" after fix-riscv-calls {39// CHECK:      jr a0 # TAILCALL  # Offset: 040 41  .globl _start42  .p2align 143_start:44  call f45  jal f46  jal zero, f47  .size _start, .-_start48 49  .globl long_tail50  .p2align 151long_tail:52    // NOTE: BOLT assumes indirect calls in single-BB functions are tail calls53    // so artificially introduce a second BB to force RISC-V-specific analysis54    // to get triggered.55    beq a0, a1, 1f561:57    tail f58    .size long_tail, .-long_tail59 60   .globl compressed_tail61   .p2align 162   .option rvc63compressed_tail:64    c.jr a065    .size compressed_tail, .-compressed_tail66