[llvm-commits] [llvm] r147958 - in /llvm/trunk: lib/Target/X86/X86FrameLowering.cpp test/CodeGen/X86/segmented-stacks.ll
Rafael Espindola
rafael.espindola at gmail.com
Wed Jan 11 10:41:19 PST 2012
Author: rafael
Date: Wed Jan 11 12:41:19 2012
New Revision: 147958
URL: http://llvm.org/viewvc/llvm-project?rev=147958&view=rev
Log:
Generate the segmented stack prologue for fastcc too.
Patch by Brian Anderson.
Modified:
llvm/trunk/lib/Target/X86/X86FrameLowering.cpp
llvm/trunk/test/CodeGen/X86/segmented-stacks.ll
Modified: llvm/trunk/lib/Target/X86/X86FrameLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FrameLowering.cpp?rev=147958&r1=147957&r2=147958&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86FrameLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86FrameLowering.cpp Wed Jan 11 12:41:19 2012
@@ -1306,7 +1306,8 @@
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.");
Modified: llvm/trunk/test/CodeGen/X86/segmented-stacks.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/segmented-stacks.ll?rev=147958&r1=147957&r2=147958&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/segmented-stacks.ll (original)
+++ llvm/trunk/test/CodeGen/X86/segmented-stacks.ll Wed Jan 11 12:41:19 2012
@@ -114,3 +114,58 @@
; 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
+}
More information about the llvm-commits
mailing list