[LLVMdev] LLVM and little-endian 32-bit MIPS code generation

Akira Hatanaka ahatanak at gmail.com
Sun Jul 10 21:22:13 PDT 2011

It will produce little-endian code if you replace "mips" with "mipsel".

1. clang -ccc-host-triple mipsel-unknown-linux -ccc-clang-archs mipsel -O3
-S -emit-llvm foo.c -o foo.ll
2. llc -march=mipsel -mcpu=4ke foo.ll -o foo.s (the -march option is

If you do not specify the target cpu with -mcpu, by default it will generate
code for Mips1, which has not been tested as thoroughly as Mips32r2
(-mcpu=4ke) or Mips2 (-mcpu=mips2).

The default ABI is o32.

On Sat, Jul 9, 2011 at 8:32 AM, Gang-Ryung Uh <guh at boisestate.edu> wrote:

> We are trying to use LLVM (Clang as the C frontend) to generate code for
> 32-bit MIPS (little-endian)l, which can run on simplescalar 3.0
> sslittle-na-sstrix platform. Can you advise what would be the right way to
> use the LLVM compiler infrastructure?
> The following is the one I used, but it appears that it produce the code in
> big-endian (and I wonder whether the calling convention is right.) To check
> the correctness of code generation in a quick and dirty way, I don't invoke
> LLVM "opt"
> (1) clang -emit-llvm hello.c -S -o hello.ll
> (2) llvm-as hello.ll
> (2) llc -march=mips hello.bc
> Thanks in advance.
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110710/462b8e36/attachment.html>

More information about the llvm-dev mailing list