mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-01 18:33:56 +00:00
Generate the segmented stack prologue for fastcc too.
Patch by Brian Anderson. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147958 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
11f0e7b158
commit
25cd4ff97e
@ -1306,7 +1306,8 @@ GetScratchRegister(bool Is64Bit, const MachineFunction &MF) {
|
||||
CallingConv::ID CallingConvention = MF.getFunction()->getCallingConv();
|
||||
bool IsNested = HasNestArgument(&MF);
|
||||
|
||||
if (CallingConvention == CallingConv::X86_FastCall) {
|
||||
if (CallingConvention == CallingConv::X86_FastCall ||
|
||||
CallingConvention == CallingConv::Fast) {
|
||||
if (IsNested) {
|
||||
report_fatal_error("Segmented stacks does not support fastcall with "
|
||||
"nested function.");
|
||||
|
@ -114,3 +114,58 @@ define void @test_large() {
|
||||
; X64-NEXT: ret
|
||||
|
||||
}
|
||||
|
||||
define fastcc void @test_fastcc() {
|
||||
%mem = alloca i32, i32 10
|
||||
call void @dummy_use (i32* %mem, i32 10)
|
||||
ret void
|
||||
|
||||
; X32: test_fastcc:
|
||||
|
||||
; X32: cmpl %gs:48, %esp
|
||||
; X32-NEXT: ja .LBB3_2
|
||||
|
||||
; X32: pushl $0
|
||||
; X32-NEXT: pushl $60
|
||||
; X32-NEXT: calll __morestack
|
||||
; X32-NEXT: ret
|
||||
|
||||
; X64: test_fastcc:
|
||||
|
||||
; X64: cmpq %fs:112, %rsp
|
||||
; X64-NEXT: ja .LBB3_2
|
||||
|
||||
; X64: movabsq $40, %r10
|
||||
; X64-NEXT: movabsq $0, %r11
|
||||
; X64-NEXT: callq __morestack
|
||||
; X64-NEXT: ret
|
||||
|
||||
}
|
||||
|
||||
define fastcc void @test_fastcc_large() {
|
||||
%mem = alloca i32, i32 10000
|
||||
call void @dummy_use (i32* %mem, i32 0)
|
||||
ret void
|
||||
|
||||
; X32: test_fastcc_large:
|
||||
|
||||
; X32: leal -40012(%esp), %eax
|
||||
; X32-NEXT: cmpl %gs:48, %eax
|
||||
; X32-NEXT: ja .LBB4_2
|
||||
|
||||
; X32: pushl $0
|
||||
; X32-NEXT: pushl $40012
|
||||
; X32-NEXT: calll __morestack
|
||||
; X32-NEXT: ret
|
||||
|
||||
; X64: test_fastcc_large:
|
||||
|
||||
; X64: leaq -40008(%rsp), %r11
|
||||
; X64-NEXT: cmpq %fs:112, %r11
|
||||
; X64-NEXT: ja .LBB4_2
|
||||
|
||||
; X64: movabsq $40008, %r10
|
||||
; X64-NEXT: movabsq $0, %r11
|
||||
; X64-NEXT: callq __morestack
|
||||
; X64-NEXT: ret
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user