1 # NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
3 # RUN: llc -mtriple riscv64 -start-before=prologepilog -o - \
4 # RUN: -verify-machineinstrs %s | FileCheck %s
6 # RUN: llc -mtriple riscv64 -start-before=prologepilog -o /dev/null \
7 # RUN: -debug-only=prologepilog -verify-machineinstrs %s 2>&1 \
8 # RUN: | FileCheck --check-prefix=DEBUG %s
10 # DEBUG: Adjusting emergency spill slots!
11 # DEBUG: Adjusting offset of emergency spill slot #4 from -4112 to -8192
14 ; ModuleID = 'reduced.ll'
15 source_filename = "frame_layout-1253b1.cpp"
16 target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n64-S128"
17 target triple = "riscv64"
19 ; Function Attrs: nounwind
20 define weak_odr dso_local void @foo(i8* %ay) nounwind {
22 ; CHECK: # %bb.0: # %entry
23 ; CHECK-NEXT: addi sp, sp, -2032
24 ; CHECK-NEXT: sd ra, 2024(sp) # 8-byte Folded Spill
25 ; CHECK-NEXT: sd s0, 2016(sp) # 8-byte Folded Spill
26 ; CHECK-NEXT: addi s0, sp, 2032
27 ; CHECK-NEXT: sd a1, 0(sp)
28 ; CHECK-NEXT: lui a1, 2
29 ; CHECK-NEXT: addiw a1, a1, -2032
30 ; CHECK-NEXT: sub sp, sp, a1
31 ; CHECK-NEXT: srli a1, sp, 12
32 ; CHECK-NEXT: slli sp, a1, 12
33 ; CHECK-NEXT: lui a1, 1
34 ; CHECK-NEXT: addiw a1, a1, -8
35 ; CHECK-NEXT: add a1, sp, a1
36 ; CHECK-NEXT: sd a0, 0(a1)
37 ; CHECK-NEXT: ld a1, 0(sp)
38 ; CHECK-NEXT: call foo@plt
39 ; CHECK-NEXT: lui a0, 2
40 ; CHECK-NEXT: sub sp, s0, a0
41 ; CHECK-NEXT: lui a0, 2
42 ; CHECK-NEXT: addiw a0, a0, -2032
43 ; CHECK-NEXT: add sp, sp, a0
44 ; CHECK-NEXT: ld s0, 2016(sp) # 8-byte Folded Reload
45 ; CHECK-NEXT: ld ra, 2024(sp) # 8-byte Folded Reload
46 ; CHECK-NEXT: addi sp, sp, 2032
57 tracksRegLiveness: false
61 - { id: 0, size: 8, alignment: 4096 }
62 - { id: 1, type: spill-slot, size: 8, alignment: 8 }
63 machineFunctionInfo: {}
66 liveins: $x1, $x5, $x6, $x7, $x10, $x11, $x12, $x13, $x14, $x15, $x16, $x17, $x28, $x29, $x30, $x31
68 ; This is to store something to the (non-emergency) spill slot %stack.1.
70 ; This is here just to make all the eligible registers live at this point.
71 ; This way when we replace the frame index %stack.1 with its actual address
72 ; we have to allocate a virtual register to compute it.
73 ; A later run of the the register scavenger won't find an available register
74 ; either so it will have to spill one to the emergency spill slot.
75 PseudoCALL target-flags(riscv-plt) @foo, csr_ilp32_lp64, implicit-def $x1, implicit-def $x2, implicit $x1, implicit $x5, implicit $x6, implicit $x7, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit $x14, implicit $x15, implicit $x16, implicit $x17, implicit $x28, implicit $x29, implicit $x30, implicit $x31