[cfe-commits] r67577 - /cfe/trunk/lib/CodeGen/CGCall.cpp
Daniel Dunbar
daniel at zuster.org
Mon Mar 23 22:47:29 PDT 2009
Nice; I hadn't realized it was this simple...
The gcc 4.2 dg.compat test suite now runs with no failures on my linux box,
btw.
- Daniel
2009/3/23 Eli Friedman <eli.friedman at gmail.com>
> Author: efriedma
> Date: Mon Mar 23 18:26:24 2009
> New Revision: 67577
>
> URL: http://llvm.org/viewvc/llvm-project?rev=67577&view=rev
> Log:
> Fix the ABI convention for struct returns on x86 outside of Darwin.
>
>
> Modified:
> cfe/trunk/lib/CodeGen/CGCall.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=67577&r1=67576&r2=67577&view=diff
>
>
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGCall.cpp Mon Mar 23 18:26:24 2009
> @@ -251,6 +251,8 @@
>
> /// X86_32ABIInfo - The X86-32 ABI information.
> class X86_32ABIInfo : public ABIInfo {
> + bool IsDarwin;
> +
> public:
> ABIArgInfo classifyReturnType(QualType RetTy,
> ASTContext &Context) const;
> @@ -267,6 +269,8 @@
>
> virtual llvm::Value *EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
> CodeGenFunction &CGF) const;
> +
> + X86_32ABIInfo(bool d) : ABIInfo(), IsDarwin(d) {}
> };
> }
>
> @@ -275,6 +279,9 @@
> if (RetTy->isVoidType()) {
> return ABIArgInfo::getIgnore();
> } else if (CodeGenFunction::hasAggregateLLVMType(RetTy)) {
> + // Outside of Darwin, structs and unions are always indirect.
> + if (!IsDarwin && !RetTy->isAnyComplexType())
> + return ABIArgInfo::getIndirect(0);
> // Classify "single element" structs as their element type.
> const FieldDecl *SeltFD = isSingleElementStruct(RetTy);
> if (SeltFD) {
> @@ -1183,9 +1190,10 @@
> // to free it.
> const char *TargetPrefix = getContext().Target.getTargetPrefix();
> if (strcmp(TargetPrefix, "x86") == 0) {
> + bool IsDarwin = strstr(getContext().Target.getTargetTriple(),
> "darwin");
> switch (getContext().Target.getPointerWidth(0)) {
> case 32:
> - return *(TheABIInfo = new X86_32ABIInfo());
> + return *(TheABIInfo = new X86_32ABIInfo(IsDarwin));
> case 64:
> return *(TheABIInfo = new X86_64ABIInfo());
> }
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20090323/8e08efa5/attachment.html>
More information about the cfe-commits
mailing list