r295156 - Add a definition for __STRUCT_PARM_ALIGN__ for elfv2 and 64-bit darwin platforms to match what other compilers produce.

Iain Sandoe via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 20 02:19:01 PDT 2017


> On 16 Mar 2017, at 22:43, Eric Christopher <echristo at gmail.com> wrote:
> 
> ... and ppc64 darwin preprocessor stuff isn't tested at all. We should really just delete ppc darwin support at some point. Adding Iain here since he's said that he's working on the platform :)

Indeed I am, and hope to have a set of MC layer patches that make a working 32 and 64 b assembler before euroLLVM.

I’m still working on getting an ABI match for ppc64 on Darwin, so it’s hard to comment except to state that the intention of the ABI is that entities are naturally aligned, so the 64b port ought to behave in a similar way to most others.

The alignment rules for Darwin32 ABI (especially embedded aggregate content) is somewhat special (inherited from the system on which it was based), however those are the subject of later patches (and therefore any changes needed could be accommodated along with them).

iain

> 
> At any rate I added a single test in r298006
> 
> -eric
> 
> On Wed, Feb 15, 2017 at 12:13 AM Eric Christopher <echristo at gmail.com> wrote:
> The PPC one should inherit from this. You're right I should have tested it though. Mostly ppc Darwin isn't well supported.
> 
> 
> On Wed, Feb 15, 2017, 12:06 AM Tim Shen <timshen at google.com> wrote:
> On Wed, Feb 15, 2017, 00:01 Eric Christopher via cfe-commits <cfe-commits at lists.llvm.org> wrote:
> Author: echristo
> Date: Wed Feb 15 01:50:11 2017
> New Revision: 295156
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=295156&view=rev
> Log:
> Add a definition for __STRUCT_PARM_ALIGN__ for elfv2 and 64-bit darwin platforms to match what other compilers produce.
> 
> Modified:
>     cfe/trunk/lib/Basic/Targets.cpp
>     cfe/trunk/test/Preprocessor/init.c
> 
> Modified: cfe/trunk/lib/Basic/Targets.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=295156&r1=295155&r2=295156&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Basic/Targets.cpp (original)
> +++ cfe/trunk/lib/Basic/Targets.cpp Wed Feb 15 01:50:11 2017
> @@ -1232,6 +1232,11 @@ void PPCTargetInfo::getTargetDefines(con
>    if (LongDoubleWidth == 128)
>      Builder.defineMacro("__LONG_DOUBLE_128__");
> 
> +  // Define this for elfv2 (64-bit only) or 64-bit darwin.
> +  if (ABI == "elfv2" ||
> +      (getTriple().getOS() == llvm::Triple::Darwin && PointerWidth == 64))
> 
> I also see a "DarwinTargetInfo". Maybe this should be put there as well?
> 
> +    Builder.defineMacro("__STRUCT_PARM_ALIGN__", "16");
> +
>    if (Opts.AltiVec) {
>      Builder.defineMacro("__VEC__", "10206");
>      Builder.defineMacro("__ALTIVEC__");
> 
> Modified: cfe/trunk/test/Preprocessor/init.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=295156&r1=295155&r2=295156&view=diff
> ==============================================================================
> --- cfe/trunk/test/Preprocessor/init.c (original)
> +++ cfe/trunk/test/Preprocessor/init.c Wed Feb 15 01:50:11 2017
> @@ -5635,6 +5635,7 @@
>  // PPC64LE:#define __SIZE_MAX__ 18446744073709551615UL
>  // PPC64LE:#define __SIZE_TYPE__ long unsigned int
>  // PPC64LE:#define __SIZE_WIDTH__ 64
> +// PPC64LE:#define __STRUCT_PARM_ALIGN__ 16
>  // PPC64LE:#define __UINT16_C_SUFFIX__
>  // PPC64LE:#define __UINT16_MAX__ 65535
>  // PPC64LE:#define __UINT16_TYPE__ unsigned short
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list