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:
Rafael Espindola 2012-01-11 18:41:19 +00:00
parent 11f0e7b158
commit 25cd4ff97e
2 changed files with 57 additions and 1 deletions

View File

@ -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.");

View File

@ -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
}