r222626 - CodeGen: tweak struct ABI handling
Saleem Abdulrasool
compnerd at compnerd.org
Sat Nov 22 18:16:25 PST 2014
Author: compnerd
Date: Sat Nov 22 20:16:24 2014
New Revision: 222626
URL: http://llvm.org/viewvc/llvm-project?rev=222626&view=rev
Log:
CodeGen: tweak struct ABI handling
Cygwin and MinGW fail to conform to the underlying system's structure passing
ABI. Make the check more precise to ensure that we correctly generate code for
the itanium environment.
Added:
cfe/trunk/test/CodeGen/windows-struct-abi.c
Modified:
cfe/trunk/lib/CodeGen/TargetInfo.cpp
Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=222626&r1=222625&r2=222626&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Sat Nov 22 20:16:24 2014
@@ -7207,7 +7207,7 @@ const TargetCodeGenInfo &CodeGenModule::
bool IsDarwinVectorABI = Triple.isOSDarwin();
bool IsSmallStructInRegABI =
X86_32TargetCodeGenInfo::isStructReturnInRegABI(Triple, CodeGenOpts);
- bool IsWin32FloatStructABI = Triple.isWindowsMSVCEnvironment();
+ bool IsWin32FloatStructABI = Triple.isOSWindows() && !Triple.isOSCygMing();
if (Triple.getOS() == llvm::Triple::Win32) {
return *(TheTargetCodeGenInfo =
Added: cfe/trunk/test/CodeGen/windows-struct-abi.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/windows-struct-abi.c?rev=222626&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/windows-struct-abi.c (added)
+++ cfe/trunk/test/CodeGen/windows-struct-abi.c Sat Nov 22 20:16:24 2014
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -triple i686-windows-itanium -emit-llvm -o - %s | FileCheck %s
+
+struct f1 {
+ float f;
+};
+
+struct f1 return_f1(void) { while (1); }
+
+// CHECK: define void @return_f1(%struct.f1* noalias sret %agg.result)
+
+void receive_f1(struct f1 a0) { }
+
+// CHECK: define void @receive_f1(%struct.f1* byval align 4 %a0)
+
+struct f2 {
+ float f;
+ float g;
+};
+
+struct f2 return_f2(void) { while (1); }
+
+// CHECK: define void @return_f2(%struct.f2* noalias sret %agg.result)
+
+void receive_f2(struct f2 a0) { }
+
+// CHECK: define void @receive_f2(%struct.f2* byval align 4 %a0)
+
More information about the cfe-commits
mailing list