[LLVMdev] [cfe-dev] Converting a clang -cc1 invocation into an llc invocation

Charles Davis cdavis at mymail.mines.edu
Fri Mar 12 13:20:26 PST 2010


You forgot to reply to the list. Also CC'ing LLVMdev.

On 3/12/10 1:41 PM, Edmund Grimley-Evans wrote:
>>> clang -cc1 -triple thumbv7-eabi -O3 -target-cpu cortex-a8 t.c
>>> -emit-llvm-bc
>>> llc t.bc ... -view-legalize-dags
>> You just answered your own question :). That will work quite nicely
>> actually.
> 
> Maybe it would if I knew exactly what to put instead of "...". I can't use the same options as with clang -cc1 as they are not recognised. If I put nothing I won't even be targeting the same architecture.
Oh sorry, I didn't notice that '...'. (Silly me...)

You can use -mtriple to specify the target triple to llc, and -mcpu to
specify the CPU type:
llc t.bc -mtriple=thumbv7-eabi -mcpu=cortex-a8 -view-legalize-dags

Of course, specifying the triple shouldn't be necessary, since Clang
encodes that information into the BC file. If you disassembled the BC
file into human-readable IR, you'd see something like this at the top:

target triple thumbv7-eabi

so you should only have to specify the CPU type with -mcpu.

Hope that helps.

Chip



More information about the llvm-dev mailing list