Nice; I hadn't realized it was this simple...<br><br>The gcc 4.2 dg.compat test suite now runs with no failures on my linux box, btw.<br><br> - Daniel<br><br><div class="gmail_quote">2009/3/23 Eli Friedman <span dir="ltr"><<a href="mailto:eli.friedman@gmail.com">eli.friedman@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Author: efriedma<br>
Date: Mon Mar 23 18:26:24 2009<br>
New Revision: 67577<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=67577&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=67577&view=rev</a><br>
Log:<br>
Fix the ABI convention for struct returns on x86 outside of Darwin.<br>
<br>
<br>
Modified:<br>
cfe/trunk/lib/CodeGen/CGCall.cpp<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGCall.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=67577&r1=67576&r2=67577&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=67577&r1=67576&r2=67577&view=diff</a><br>
<br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Mon Mar 23 18:26:24 2009<br>
@@ -251,6 +251,8 @@<br>
<br>
/// X86_32ABIInfo - The X86-32 ABI information.<br>
class X86_32ABIInfo : public ABIInfo {<br>
+ bool IsDarwin;<br>
+<br>
public:<br>
ABIArgInfo classifyReturnType(QualType RetTy,<br>
ASTContext &Context) const;<br>
@@ -267,6 +269,8 @@<br>
<br>
virtual llvm::Value *EmitVAArg(llvm::Value *VAListAddr, QualType Ty,<br>
CodeGenFunction &CGF) const;<br>
+<br>
+ X86_32ABIInfo(bool d) : ABIInfo(), IsDarwin(d) {}<br>
};<br>
}<br>
<br>
@@ -275,6 +279,9 @@<br>
if (RetTy->isVoidType()) {<br>
return ABIArgInfo::getIgnore();<br>
} else if (CodeGenFunction::hasAggregateLLVMType(RetTy)) {<br>
+ // Outside of Darwin, structs and unions are always indirect.<br>
+ if (!IsDarwin && !RetTy->isAnyComplexType())<br>
+ return ABIArgInfo::getIndirect(0);<br>
// Classify "single element" structs as their element type.<br>
const FieldDecl *SeltFD = isSingleElementStruct(RetTy);<br>
if (SeltFD) {<br>
@@ -1183,9 +1190,10 @@<br>
// to free it.<br>
const char *TargetPrefix = getContext().Target.getTargetPrefix();<br>
if (strcmp(TargetPrefix, "x86") == 0) {<br>
+ bool IsDarwin = strstr(getContext().Target.getTargetTriple(), "darwin");<br>
switch (getContext().Target.getPointerWidth(0)) {<br>
case 32:<br>
- return *(TheABIInfo = new X86_32ABIInfo());<br>
+ return *(TheABIInfo = new X86_32ABIInfo(IsDarwin));<br>
case 64:<br>
return *(TheABIInfo = new X86_64ABIInfo());<br>
}<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br>