[cfe-dev] How do I specify a specific PowerPC CPU to clang?

Hal Finkel hfinkel at anl.gov
Mon Jun 18 17:09:01 PDT 2012


Sean, Richard,

I added -mcpu support for PPC to trunk clang in r158334. Does this not
work for you?

 -Hal

On Mon, 18 Jun 2012 18:47 -0500
Richard Pennington <rich at pennware.com> wrote:

> On Monday, June 18, 2012 04:32:15 PM Sean Payne wrote:
> 
> I want to have clang and then llvm generate code for a specific CPU.
> Eg, suppose I want it to build for the PowerPC 750 CPU, how am I
> meant to tell clang  
> 
> 
> I'm running the latest latest trunk versions of clang and llvm on
> windows and I'm running clang in the debugger.  I've tried all sorts
> of combinations, but can't get the "CPU" member of TargetOptions to
> be populated.  e.g. here are some arguments I've tried that didn't
> work: -target ppc750-bla-darwin   -S c: \projects\llvm_750\test1.cpp
> -o -
> 
> 
> Thanks,
> 
> 
> Sean 
> 
> 
> Hi Sean,
> 
> Interesting you should ask this question. Today I added an -mcpu
> option to my version off clang/LLVM:
> 
> [~/ellcc] main% bin/ecc -target ppc-ellcc-linux hello.c -v -mcpu=750
> clang version 3.2
> (http://ellcc.org/svn/ellcc/branches/newlib/llvm/tools/clang 2979)
> Target: ppc-ellcc-linux
> Thread model: posix
>  "/home/rich/ellcc/bin/ecc" -cc1 -triple ppc-ellcc-linux -S
> -disable-free - main-file-name hello.c -mrelocation-model static
> -mdisable-fp-elim -fmath-errno -mconstructor-aliases -msoft-float
> -target-cpu 750 -target-linker-version 2.21.53.0.1
> -momit-leaf-frame-pointer -v
> -resource-dir /home/rich/ellcc/bin/../libecc
> -fmodule-cache-path /var/tmp/clang-module-cache
> -fno-dwarf-directory-asm -fdebug-compilation-dir /home/rich/ellcc
> -ferror- limit 19 -fmessage-length 87 -mstackrealign -fno-signed-char
> -fgnu-runtime - fobjc-runtime-has-arc -fobjc-runtime-has-weak
> -fobjc-fragile-abi - fdiagnostics-show-option -fcolor-diagnostics
> -o /tmp/hello-KzHR2J.s -x c hello.c clang -cc1 version 3.2 based upon
> LLVM 3.2svn default target x86_64-unknown- linux-gnu #include "..."
> search starts here: #include <...> search starts here:
>  /home/rich/ellcc/bin/../libecc/include
>  /home/rich/ellcc/bin/../libecc/usrinclude/ppc/linux
>  /home/rich/ellcc/bin/../libecc/usrinclude/ppc
>  /home/rich/ellcc/bin/../libecc/usrinclude/linux
>  /home/rich/ellcc/bin/../libecc/usrinclude
> End of search list.
>  "/home/rich/ellcc/bin/ppc-elf-as"
> -o /tmp/hello-ZIWKej.o /tmp/hello-KzHR2J.s -a32
>  "/home/rich/ellcc/bin/ecc-ld" -m elf32ppc --build-id
> --hash-style=gnu -e _start --eh-frame-hdr -Bdynamic
> -dynamic-linker /usr/libexec/ld.so -o
> a.out /home/rich/ellcc/bin/../libecc/lib/ppc/linux/crt0.o /home/rich/ellcc/bin/../libecc/lib/ppc/linux/crtbegin.o
> -nostdlib - L/home/rich/ellcc/bin/../libecc/ldscripts/linux -
> L/home/rich/ellcc/bin/../libecc/lib/ppc/linux -
> L/home/rich/ellcc/bin/../libecc/lib/ppc /tmp/hello-ZIWKej.o
> -Telf32ppc.x -lc -
> lcompiler-rt /home/rich/ellcc/bin/../libecc/lib/ppc/linux/crtend.o
> [~/ellcc] main% 
> 
> Currently the TOT doesn't support -mcpu for the PowerPC.
> 
> -Rich


-- 
Hal Finkel
Postdoctoral Appointee
Leadership Computing Facility
Argonne National Laboratory



More information about the cfe-dev mailing list