mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-29 10:32:47 +00:00
9a154bfe94
The PPCFrameLowering::determineFrameLayout routine currently ensures that every function that allocates a stack frame provides space for the parameter save area (via PPCFrameLowering::getMinCallFrameSize). This is actually not necessary. There may be functions that never call another routine but still allocate a frame; those do not require the parameter save area. In the future, with the ELFv2 ABI, even some routines that do call other functions do not need to allocate the parameter save area. While it is not a bug to allocate the parameter area when it is not needed, it is better to avoid it to save stack space. Note that when any particular function call requires the parameter save area, this space will already have been included by ABI code in the size the CALLSEQ_START insn is annotated with, and therefore included in the size returned by MFI->getMaxCallFrameSize(). This means that determineFrameLayout simply does not need to care about the parameter save area. (It still needs to ensure that every frame provides the linkage area.) This is implemented by this patch. Note that this exposed a bug in the new fast-isel code where the parameter area was *not* included in the CALLSEQ_START size; this is also fixed. A couple of test cases needed to be adapted for the new (smaller) stack frame size those tests now see. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211495 91177308-0d34-0410-b5e6-96231b3b80d8
40 lines
802 B
LLVM
40 lines
802 B
LLVM
; RUN: llc -mtriple="powerpc-unknown-linux-gnu" < %s | FileCheck %s --check-prefix=PPC32
|
|
; RUN: llc -mtriple="powerpc64-unknown-linux-gnu" < %s | FileCheck %s --check-prefix=PPC64
|
|
; PR15332
|
|
|
|
define void @regalloc() nounwind {
|
|
entry:
|
|
%0 = add i32 1, 2
|
|
ret void
|
|
}
|
|
; PPC32-LABEL: regalloc:
|
|
; PPC32-NOT: stwu 1, -{{[0-9]+}}(1)
|
|
; PPC32: blr
|
|
|
|
; PPC64-LABEL: regalloc:
|
|
; PPC64-NOT: stdu 1, -{{[0-9]+}}(1)
|
|
; PPC64: blr
|
|
|
|
define void @smallstack() nounwind {
|
|
entry:
|
|
%0 = alloca i8, i32 4
|
|
ret void
|
|
}
|
|
; PPC32-LABEL: smallstack:
|
|
; PPC32: stwu 1, -16(1)
|
|
|
|
; PPC64-LABEL: smallstack:
|
|
; PPC64-NOT: stdu 1, -{{[0-9]+}}(1)
|
|
; PPC64: blr
|
|
|
|
define void @bigstack() nounwind {
|
|
entry:
|
|
%0 = alloca i8, i32 230
|
|
ret void
|
|
}
|
|
; PPC32-LABEL: bigstack:
|
|
; PPC32: stwu 1, -240(1)
|
|
|
|
; PPC64-LABEL: bigstack:
|
|
; PPC64: stdu 1, -288(1)
|