xref: /llvm-project/llvm/test/CodeGen/ARM/nonreserved-callframe-with-basereg.mir (revision fae05692a36f9ebbd201d93c2a6b0f927564d7e6)
1# RUN: llc -run-pass=prologepilog %s -o -  | FileCheck %s
2
3# Make sure we use the correct offset for stack accesses using the base pointer
4# within call frame blocks. Key points of test:
5#    + A large SP in ADJCALLSTACKDOWN forces each call to get its own adjustment.
6#    + An over-aligned stack variable means that we must use r6 rather than fp
7#      to access this variables.
8#
9# Under these circumstances, the ADJCALLSTACKDOWN must not apply to r6 offsets.
10
11--- |
12  ; ModuleID = 'simple.ll'
13  source_filename = "simple.ll"
14  target datalayout = "e-m:o-p:32:32-i64:64-a:0:32-n32-S128"
15  target triple = "thumbv7k-apple-ios"
16
17  declare void @bar([4 x i32], i32)
18
19  define void @foo(i32 %n) {
20    ret void
21  }
22
23...
24---
25name:            foo
26liveins:
27  - { reg: '$r0', virtual-reg: '' }
28frameInfo:
29  adjustsStack:    true
30  hasCalls:        true
31  maxCallFrameSize: 2276
32stack:
33  - { id: 0, name: '', type: spill-slot, offset: 0, alignment: 32,  size: 4 }
34constants:       []
35body:             |
36  bb.0 (%ir-block.0):
37    liveins: $r0
38
39    ; CHECK: t2STRi12 killed $r0, $r6, [[OFFSET:[0-9]+]]
40    t2STRi12 killed $r0, %stack.0, 0, 14, $noreg :: (store (s32) into %stack.0)
41
42    ADJCALLSTACKDOWN 2276, 0, 14, $noreg, implicit-def dead $sp, implicit $sp
43
44    ; CHECK: renamable $r0 = t2LDRi12 $r6, [[OFFSET]]
45    renamable $r0 = t2LDRi12 %stack.0, 0, 14, $noreg, :: (load (s32) from %stack.0)
46    renamable $r1 = IMPLICIT_DEF
47    renamable $r2 = IMPLICIT_DEF
48    renamable $r3 = IMPLICIT_DEF
49    tBL 14, $noreg, @bar, csr_ios, implicit-def dead $lr, implicit $sp, implicit killed $r0, implicit killed $r1, implicit killed $r2, implicit killed $r3, implicit-def $sp
50
51    ADJCALLSTACKUP 2276, 0, 14, $noreg, implicit-def dead $sp, implicit $sp
52    tBX_RET 14, $noreg
53
54...
55