r241925 - Refactor PPC ABI handling to accept and silently ignore -mabi=altivec.

Hal Finkel hfinkel at anl.gov
Fri Jul 10 11:42:08 PDT 2015


----- Original Message -----
> From: "Eric Christopher" <echristo at gmail.com>
> To: cfe-commits at cs.uiuc.edu
> Sent: Friday, July 10, 2015 1:25:54 PM
> Subject: r241925 - Refactor PPC ABI handling to accept and silently ignore	-mabi=altivec.
> 
> Author: echristo
> Date: Fri Jul 10 13:25:54 2015
> New Revision: 241925
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=241925&view=rev
> Log:
> Refactor PPC ABI handling to accept and	silently ignore
> -mabi=altivec.
> 
> All of the ABIs we support are altivec style anyhow and so the option
> doesn't make much sense with the modern ABIs. We could make this a
> more
> noisy ignore, but it would break builds for projects that just pass
> it along by default because of historical reasons.
> 
> Modified:
>     cfe/trunk/lib/Driver/Tools.cpp
>     cfe/trunk/test/Driver/ppc-abi.c
> 
> Modified: cfe/trunk/lib/Driver/Tools.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=241925&r1=241924&r2=241925&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Driver/Tools.cpp (original)
> +++ cfe/trunk/lib/Driver/Tools.cpp Fri Jul 10 13:25:54 2015
> @@ -1272,9 +1272,7 @@ void Clang::AddPPCTargetArgs(const ArgLi
>                               ArgStringList &CmdArgs) const {
>    // Select the ABI to use.
>    const char *ABIName = nullptr;
> -  if (Arg *A = Args.getLastArg(options::OPT_mabi_EQ)) {
> -    ABIName = A->getValue();
> -  } else if (getToolChain().getTriple().isOSLinux())
> +  if (getToolChain().getTriple().isOSLinux())
>      switch (getToolChain().getArch()) {
>      case llvm::Triple::ppc64: {
>        // When targeting a processor that supports QPX, or if QPX is
> @@ -1299,6 +1297,13 @@ void Clang::AddPPCTargetArgs(const ArgLi
>        break;
>      }
>  
> +  if (Arg *A = Args.getLastArg(options::OPT_mabi_EQ))
> +    // The ppc64 linux abis are all "altivec" abis by default.
> Accept and ignore
> +    // the option if given as we don't have backend support for any
> targets
> +    // that don't use the altivec abi.

I'm sorry, I should have warned you. This is not quite true. The QPX ABI is not an altivec ABI, and we should do something slightly different in that case. My preference is to produce an error, maybe something like this:

  if (StringRef(A->getValue()) == "altivec" && ABIName == "elfv1-qpx")
    error: The Altivec ABI is incompatible with QPX

Thanks again,
Hal 

> +    if (StringRef(A->getValue()) != "altivec")
> +      ABIName = A->getValue();
> +
>    if (ABIName) {
>      CmdArgs.push_back("-target-abi");
>      CmdArgs.push_back(ABIName);
> 
> Modified: cfe/trunk/test/Driver/ppc-abi.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/ppc-abi.c?rev=241925&r1=241924&r2=241925&view=diff
> ==============================================================================
> --- cfe/trunk/test/Driver/ppc-abi.c (original)
> +++ cfe/trunk/test/Driver/ppc-abi.c Fri Jul 10 13:25:54 2015
> @@ -21,6 +21,8 @@
>  // RUN:   -mabi=elfv1 | FileCheck -check-prefix=CHECK-ELFv1 %s
>  // RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -o %t.o
>  2>&1 \
>  // RUN:   -mabi=elfv2 | FileCheck -check-prefix=CHECK-ELFv2 %s
> +// RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -o %t.o
> 2>&1 \
> +// RUN:   -mabi=altivec | FileCheck -check-prefix=CHECK-ELFv2 %s
>  
>  // CHECK-ELFv1: "-target-abi" "elfv1"
>  // CHECK-ELFv1-QPX: "-target-abi" "elfv1-qpx"
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory



More information about the cfe-commits mailing list