From 9d697e1c3cc013e64fbebf6c00f039d7b6839cb0 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Wed, 20 Sep 2017 21:00:40 +0000 Subject: [PATCH] X86: treat SwiftCC as Win64_CC on Win64 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313813 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86Subtarget.h | 1 + test/CodeGen/X86/swiftcc.ll | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 test/CodeGen/X86/swiftcc.ll diff --git a/lib/Target/X86/X86Subtarget.h b/lib/Target/X86/X86Subtarget.h index 61fa9252770..a8de6eaf1cc 100644 --- a/lib/Target/X86/X86Subtarget.h +++ b/lib/Target/X86/X86Subtarget.h @@ -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/test/CodeGen/X86/swiftcc.ll b/test/CodeGen/X86/swiftcc.ll new file mode 100644 index 00000000000..dc36ee247f1 --- /dev/null +++ b/test/CodeGen/X86/swiftcc.ll @@ -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 + -- 2.40.0