[LLVMdev] ARM assembly

Tim Northover t.p.northover at gmail.com
Mon Dec 10 08:54:16 PST 2012


Hi Amir,

> 1) clang -emit-llvm main.ll main.c
> 2) llc -march=arm -o main.s main.bc
>
> In this case it doesn't use the registers which I added to the architecture.
> Do you have any ideas?

Evan's suggestion was probably a good one. If you replace the clang command with
$ clang -O3 -emit-llvm main.c

then llc should be able to use more registers for the resulting main.bc.

> As far as I know, the generated ll code doesn't depend on the target
> (right?), but I see this line in the ll code : target triple =
> "x86_64-unknown-linux-gnu"
> Could it be the problem?

It's not *this* problem, and as long as you don't try to do anything
too complicated (including trying to run the output) you'll probably
get away with it, but it's not ideal.

What you really want is a cross-toolchain and to point clang at this
toolchain. Most importantly with the option "-target
arm-none-linux-gnueabi" (or similar), but possibly also telling it
where the headers and libraries are with other options.

Tim.



More information about the llvm-dev mailing list