r329025 - CodeGenCXX: support PreserveMostCC in MS ABI

Saleem Abdulrasool via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 2 15:25:50 PDT 2018


Author: compnerd
Date: Mon Apr  2 15:25:50 2018
New Revision: 329025

URL: http://llvm.org/viewvc/llvm-project?rev=329025&view=rev
Log:
CodeGenCXX: support PreserveMostCC in MS ABI

Microsoft has reserved 'U' for the PreserveMostCC which is used in the
swift runtime.  Add support for this.  This allows the swift runtime to
be built for Windows again.

Modified:
    cfe/trunk/lib/AST/MicrosoftMangle.cpp
    cfe/trunk/lib/Basic/Targets/X86.h
    cfe/trunk/test/CodeGenCXX/msabi-swiftcall-cc.cpp

Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=329025&r1=329024&r2=329025&view=diff
==============================================================================
--- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)
+++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Mon Apr  2 15:25:50 2018
@@ -2184,6 +2184,7 @@ void MicrosoftCXXNameMangler::mangleCall
     case CC_X86FastCall: Out << 'I'; break;
     case CC_X86VectorCall: Out << 'Q'; break;
     case CC_Swift: Out << 'S'; break;
+    case CC_PreserveMost: Out << 'U'; break;
     case CC_X86RegCall: Out << 'w'; break;
   }
 }

Modified: cfe/trunk/lib/Basic/Targets/X86.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/X86.h?rev=329025&r1=329024&r2=329025&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets/X86.h (original)
+++ cfe/trunk/lib/Basic/Targets/X86.h Mon Apr  2 15:25:50 2018
@@ -287,6 +287,7 @@ public:
     case CC_X86VectorCall:
     case CC_X86RegCall:
     case CC_C:
+    case CC_PreserveMost:
     case CC_Swift:
     case CC_X86Pascal:
     case CC_IntelOclBicc:

Modified: cfe/trunk/test/CodeGenCXX/msabi-swiftcall-cc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/msabi-swiftcall-cc.cpp?rev=329025&r1=329024&r2=329025&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/msabi-swiftcall-cc.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/msabi-swiftcall-cc.cpp Mon Apr  2 15:25:50 2018
@@ -1,28 +1,67 @@
 // RUN: %clang_cc1 -triple i686-unknown-windows-msvc -fdeclspec -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -fdeclspec -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-64
 
 void __attribute__((__swiftcall__)) f() {}
 // CHECK-DAG: @"?f@@YSXXZ"
+// CHECK-64-DAG: @"?f@@YSXXZ"
 
 void (__attribute__((__swiftcall__)) *p)();
 // CHECK-DAG: @"?p@@3P6SXXZA"
+// CHECK-64-DAG: @"?p@@3P6SXXZEA
 
 namespace {
 void __attribute__((__swiftcall__)) __attribute__((__used__)) f() { }
-// CHECK-DAG: "?f@?A@@YSXXZ"
 }
+// CHECK-DAG: @"?f@?A@@YSXXZ"
+// CHECK-64-DAG: @"?f@?A@@YSXXZ"
 
 namespace n {
 void __attribute__((__swiftcall__)) f() {}
-// CHECK-DAG: "?f at n@@YSXXZ"
 }
+// CHECK-DAG: @"?f at n@@YSXXZ"
+// CHECK-64-DAG: @"?f at n@@YSXXZ"
 
 struct __declspec(dllexport) S {
   S(const S &) = delete;
   S & operator=(const S &) = delete;
   void __attribute__((__swiftcall__)) m() { }
-  // CHECK-DAG: "?m at S@@QASXXZ"
 };
+// CHECK-DAG: @"?m at S@@QASXXZ"
+// CHECK-64-DAG: @"?m at S@@QEASXXZ"
 
 void f(void (__attribute__((__swiftcall__))())) {}
-// CHECK-DAG: "?f@@YAXP6SXXZ at Z"
+// CHECK-DAG: @"?f@@YAXP6SXXZ at Z"
+// CHECK-64-DAG: @"?f@@YAXP6SXXZ at Z"
+
+void __attribute__((__preserve_most__)) g() {}
+// CHECK-DAG: @"?g@@YUXXZ"
+// CHECK-64-DAG: @"?g@@YUXXZ"
+
+void (__attribute__((__preserve_most__)) *q)();
+// CHECK-DAG: @"?q@@3P6UXXZA"
+// CHECK-64-DAG: @"?q@@3P6UXXZEA"
+
+namespace {
+void __attribute__((__preserve_most__)) __attribute__((__used__)) g() {}
+}
+// CHECK-DAG: @"?g@?A@@YUXXZ"
+// CHECK-64-DAG: @"?g@?A@@YUXXZ"
+
+namespace n {
+void __attribute__((__preserve_most__)) g() {}
+}
+// CHECK-DAG: @"?g at n@@YUXXZ"
+// CHECK-64-DAG: @"?g at n@@YUXXZ"
+
+struct __declspec(dllexport) T {
+  T(const T &) = delete;
+  T & operator=(const T &) = delete;
+  void __attribute__((__preserve_most__)) m() {}
+};
+// CHECK-DAG: @"?m at T@@QAUXXZ"
+// CHECK-64-DAG: @"?m at T@@QEAUXXZ"
+
+void g(void (__attribute__((__preserve_most__))())) {}
+// CHECK-DAG: @"?g@@YAXP6UXXZ at Z"
+// CHECK-64-DAG: @"?g@@YAXP6UXXZ at Z"
 




More information about the cfe-commits mailing list