[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cfe-commits
Subject:    [PATCH] D12034: WindowsARM: ignore calling conventions as described on MSDN
From:       Martell Malone via cfe-commits <cfe-commits () lists ! llvm ! org>
Date:       2015-08-14 16:17:42
Message-ID: differential-rev-PHID-DREV-4zoaziv62n3nmvkddlz5-req () reviews ! llvm ! org
[Download RAW message or body]

martell created this revision.
martell added a reviewer: rnk.
martell added subscribers: compnerd, cfe-commits.
Herald added subscribers: rengolin, aemerson.

MSDN says that fastcall stdcall and thiscall and vectorcall are all accepted but \
ignored on ARM and X64

https://msdn.microsoft.com/en-us/library/984x0h58.aspx

MSDN also says that cdecl is accepted but typically ignored

This patch brings ARM in line with how we ignore them for X64

http://reviews.llvm.org/D12034

Files:
  lib/Basic/Targets.cpp
  test/Parser/arm-windows-calling-convention-handling.c

Index: test/Parser/arm-windows-calling-convention-handling.c
===================================================================
--- test/Parser/arm-windows-calling-convention-handling.c
+++ /dev/null
@@ -1,10 +0,0 @@
-// RUN: %clang_cc1 -triple thumbv7-windows -fms-compatibility -fsyntax-only -verify \
                %s
-
-int __cdecl cdecl(int a, int b, int c, int d) { // expected-warning {{calling \
                convention '__cdecl' ignored for this target}}
-  return a + b + c + d;
-}
-
-float __stdcall stdcall(float a, float b, float c, float d) { // expected-warning \
                {{calling convention '__stdcall' ignored for this target}}
-  return a + b + c + d;
-}
-
Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -4959,6 +4959,19 @@
   BuiltinVaListKind getBuiltinVaListKind() const override {
     return TargetInfo::CharPtrBuiltinVaList;
   }
+  CallingConvCheckResult checkCallingConvention(CallingConv CC) const override {
+    switch (CC) {
+    case CC_X86StdCall:
+    case CC_X86ThisCall:
+    case CC_X86FastCall:
+    case CC_X86VectorCall:
+      return CCCR_Ignore;
+    case CC_C:
+      return CCCR_OK;
+    default:
+      return CCCR_Warning;
+    }
+  }
 };
 
 // Windows ARM + Itanium C++ ABI Target


["D12034.32158.patch" (text/x-patch)]

Index: test/Parser/arm-windows-calling-convention-handling.c
===================================================================
--- test/Parser/arm-windows-calling-convention-handling.c
+++ /dev/null
@@ -1,10 +0,0 @@
-// RUN: %clang_cc1 -triple thumbv7-windows -fms-compatibility -fsyntax-only -verify \
                %s
-
-int __cdecl cdecl(int a, int b, int c, int d) { // expected-warning {{calling \
                convention '__cdecl' ignored for this target}}
-  return a + b + c + d;
-}
-
-float __stdcall stdcall(float a, float b, float c, float d) { // expected-warning \
                {{calling convention '__stdcall' ignored for this target}}
-  return a + b + c + d;
-}
-
Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -4959,6 +4959,19 @@
   BuiltinVaListKind getBuiltinVaListKind() const override {
     return TargetInfo::CharPtrBuiltinVaList;
   }
+  CallingConvCheckResult checkCallingConvention(CallingConv CC) const override {
+    switch (CC) {
+    case CC_X86StdCall:
+    case CC_X86ThisCall:
+    case CC_X86FastCall:
+    case CC_X86VectorCall:
+      return CCCR_Ignore;
+    case CC_C:
+      return CCCR_OK;
+    default:
+      return CCCR_Warning;
+    }
+  }
 };
 
 // Windows ARM + Itanium C++ ABI Target


[Attachment #4 (text/plain)]

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic