It will produce little-endian code if you replace "mips" with "mipsel".<br><br>1. clang -ccc-host-triple mipsel-unknown-linux -ccc-clang-archs mipsel -O3 -S -emit-llvm foo.c -o foo.ll<br>2. llc -march=mipsel -mcpu=4ke foo.ll -o foo.s (the -march option is redundant)<br>
<br>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).<br><br>The default ABI is o32.<br><div class="gmail_quote">
<br>On Sat, Jul 9, 2011 at 8:32 AM, Gang-Ryung Uh <span dir="ltr"><<a href="mailto:guh@boisestate.edu">guh@boisestate.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
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?<div>

<br></div><div>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"</div>

<div><br></div><div>(1) clang -emit-llvm hello.c -S -o hello.ll</div><div>(2) llvm-as hello.ll</div><div>(2) llc -march=mips hello.bc</div><div><br></div><div>Thanks in advance.<br clear="all"><br>
</div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br>