[cfe-dev] clang command line options to select target CPU

Paul S clang at dataworx.com.au
Tue Mar 13 04:22:54 PDT 2012


Can somebody please help out a poor noob...

I'm aware that support for CPUs other than X86 and ARM is experimental, 
but I'm considering targeting an embedded CPU with clang/llvm and I 
would like to inspect the code quality produced for the msp430, 
Microblaze, MIPS etc for a small test case.

I've built clang 3.0 from source with support for all targets

llc -- version yields

Low Level Virtual Machine (http://llvm.org/):
   llvm version 3.0
   Optimized build.
   Built Mar 11 2012 (07:46:13).
   Host: i386-pc-linux-gnu
   Host CPU: amdfam10

   Registered Targets:
     alpha    - Alpha [experimental]
     arm      - ARM
     bfin     - Analog Devices Blackfin [experimental]
     c        - C backend
...
...
     mblaze   - MBlaze
     mips     - Mips
...
     msp430   - MSP430 [experimental]
...
     thumb    - Thumb
     x86      - 32-bit X86: Pentium-Pro and above
     x86-64   - 64-bit X86: EM64T and AMD64
     xcore    - XCore

Following the clang man page target option info ...

clang -arch msp430 -S t.c

rewards me with
clang: warning: argument unused during compilation: '-arch msp430'
I also tried

clang -arch=msp430 -S t.c

with the same outcome.
and

clang -march=msp430 -S t.c

gives ...
error: unknown target CPU 'msp430'


I've tried a few other targets all with similar outcomes.

Can anybody steer me in the right direction ?

Thanks in advance,
Paul S.









More information about the cfe-dev mailing list