Files
clang-p2996/llvm/test/CodeGen/AArch64/spill-stack-realignment.mir
Momchil Velikov dedf2c6bb5 [AArch64] Refactor allocation of locals and stack realignment (#72028)
Factor out some stack allocation in a separate function. This patch
splits out the generic portion of a larger refactoring done as a part of
stack clash protection support.

The patch is almost, but not quite NFC. The only difference should
be that where we have adjacent allocation of stack space
for local SVE objects and non-local SVE objects the order
of `sub sp, ...` and `addvl sp, ...` instructions is reversed, because now
it's done with a single call to `emitFrameOffset` and it happens
add/subtract the fixed part before the scalable part, e.g.

    addvl sp, sp, #-2
    sub sp, sp, #16, lsl #12
    sub sp, sp, #16

becomes

    sub sp, sp, #16, lsl #12
    sub sp, sp, #16
    addvl sp, sp, #-2
2023-11-15 09:27:01 +00:00

36 lines
1.3 KiB
YAML

# RUN: llc -mtriple=aarch64-none-linux-gnu -run-pass=prologepilog %s -o - | FileCheck %s
# Ensure references to scavenged stack slots in the CSR area use the
# FP as a base when the stack pointer must be aligned to something
# larger than required by the target. This is necessary because the
# alignment padding area is between the CSR area and the SP, so the SP
# cannot be used to reference the CSR area.
name: test
tracksRegLiveness: true
frameInfo:
maxAlignment: 64
# CHECK: stack:
# CHECK: id: 0, name: '', type: default, offset: -64, size: 4, alignment: 64
# CHECK-NEXT: stack-id: default
# CHECK-NEXT: local-offset: -64
# CHECK: id: 1, name: '', type: default, offset: -4, size: 4, alignment: 4
# CHECK-NEXT: stack-id: default
# CHECK-NEXT: local-offset: -68
stack:
- { id: 0, size: 4, alignment: 64, local-offset: -64 }
- { id: 1, size: 4, alignment: 4, local-offset: -68 }
# CHECK: body:
# CHECK: $sp = frame-setup ANDXri killed ${{x[0-9]+}}, 7865
# CHECK: STRSui $s0, $sp, 0
# CHECK: STRSui $s0, $fp, 7
body: |
bb.0.entry:
liveins: $s0
STRSui $s0, %stack.0, 0
STRSui $s0, %stack.1, 0
; Force preserve a CSR to create a hole in the CSR stack region.
$x28 = IMPLICIT_DEF
RET_ReallyLR