X86: treat SwiftCC as Win64_CC on Win64
authorSaleem Abdulrasool <compnerd@compnerd.org>
Wed, 20 Sep 2017 21:00:40 +0000 (21:00 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Wed, 20 Sep 2017 21:00:40 +0000 (21:00 +0000)
The Swift CC is identical to Win64 CC with the exception of swift error
being passed in r12 which is a CSR.  However, since this calling
convention is only used in swift -> swift code, it does not impact
interoperability and can be treated entirely as Win64 CC.  We would
previously incorrectly lower the frame setup as we did not treat the
frame as conforming to Win64 specifications.

llvm-svn: 313813

llvm/lib/Target/X86/X86Subtarget.h
llvm/test/CodeGen/X86/swiftcc.ll [new file with mode: 0644]

index 61fa925..a8de6ea 100644 (file)
@@ -614,6 +614,7 @@ public:
     // On Win64, all these conventions just use the default convention.
     case CallingConv::C:
     case CallingConv::Fast:
+    case CallingConv::Swift:
     case CallingConv::X86_FastCall:
     case CallingConv::X86_StdCall:
     case CallingConv::X86_ThisCall:
diff --git a/llvm/test/CodeGen/X86/swiftcc.ll b/llvm/test/CodeGen/X86/swiftcc.ll
new file mode 100644 (file)
index 0000000..dc36ee2
--- /dev/null
@@ -0,0 +1,11 @@
+; RUN: llc -mtriple x86_64-unknown-windows-msvc -filetype asm -o - %s | FileCheck %s
+
+define swiftcc void @f() {
+  %1 = alloca i8
+  ret void
+}
+
+; CHECK-LABEL: f
+; CHECK: .seh_stackalloc 8
+; CHECK: .seh_endprologue
+