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

Richard Pennington rich at pennware.com
Mon Jun 18 16:47:00 PDT 2012


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120618/2e552ea9/attachment.html>


More information about the cfe-dev mailing list