[PATCH] [WinX86_64 ABI] Handle C99 _Complex as a struct
Michael Kuperstein
michael.m.kuperstein at intel.com
Mon Feb 23 03:28:29 PST 2015
Hi rnk, majnemer, chapuni,
MSVC does not support C99 _Complex, and apparently has no plans to support it ( https://connect.microsoft.com/VisualStudio/feedback/details/891891/c99-complex-number-support )
ICC, however, does support _Complex on windows x86_64, and treats it, for purposes of parameter passing, as equivalent to a struct containing two fields (for the real and imaginary part). This makes clang handle it the same way.
http://reviews.llvm.org/D7825
Files:
lib/CodeGen/TargetInfo.cpp
test/CodeGen/x86_64-arguments-win32.c
Index: test/CodeGen/x86_64-arguments-win32.c
===================================================================
--- test/CodeGen/x86_64-arguments-win32.c
+++ test/CodeGen/x86_64-arguments-win32.c
@@ -14,3 +14,9 @@
// CHECK-LABEL: define void @f4(i16 %a)
void f4(unsigned short a) {}
+
+// CHECK-LABEL: define void @f5(i64 %a.coerce)
+void f5(_Complex float a) {}
+
+// CHECK-LABEL: define void @f6({ double, double }* %a)
+void f6(_Complex double a) {}
Index: lib/CodeGen/TargetInfo.cpp
===================================================================
--- lib/CodeGen/TargetInfo.cpp
+++ lib/CodeGen/TargetInfo.cpp
@@ -3034,7 +3034,7 @@
return ABIArgInfo::getDirect();
}
- if (RT || Ty->isMemberPointerType()) {
+ if (RT || Ty->isAnyComplexType() || Ty->isMemberPointerType()) {
// MS x64 ABI requirement: "Any argument that doesn't fit in 8 bytes, or is
// not 1, 2, 4, or 8 bytes, must be passed by reference."
if (Width > 64 || !llvm::isPowerOf2_64(Width))
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7825.20497.patch
Type: text/x-patch
Size: 1013 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150223/97130e39/attachment.bin>
More information about the cfe-commits
mailing list