Hi,<div><br></div><div>    We have tried and generate assembly code for very simple test C code. But, binutils-2.5.2 (simplesim-3.0) cannot handle the produced assembly code with the following complaints. Could you advise which version of bitutils that we need to use for mips code with LLVM with Clang? Thanks,</div>
<div><br></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">$ GCC addr01.s<br>addr01.s: Assembler messages:<br>addr01.s:1: Error: Unknown pseudo-op:  `.section'<br>
addr01.s:2: Error: Unknown pseudo-op:  `.previous'<br>addr01.s:3: Error: Bad expression<br>addr01.s:3: Warning: Missing string<br>addr01.s:3: Error: Rest of line ignored. First ignored character is `a'.<br>addr01.s:3: Error: Rest of line ignored. First ignored character valued 0x9.<br>
addr01.s:6: Warning: .type pseudo-op used outside of .def/.endef; ignored<br>addr01.s:6: Error: Rest of line ignored. First ignored character is `f'.<br>addr01.s:9: Warning: Unrecognized register name<br>addr01.s:17: Error: ERROR: Illegal operands `sw $ra,28($sp)'<br>
addr01.s:19: Warning: Instruction addiu requires absolute expression<br>addr01.s:19: Error: ERROR: Illegal operands `addiu $5,$zero,1'<br>addr01.s:21: Error: Bad expression<br>addr01.s:21: Error: Bad expression</span></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">....<br></span></font><br><div class="gmail_quote">On Sun, Jul 10, 2011 at 10:22 PM, Akira Hatanaka <span dir="ltr"><<a href="mailto:ahatanak@gmail.com">ahatanak@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">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">
<div><div></div><div class="h5">
<br>On Sat, Jul 9, 2011 at 8:32 AM, Gang-Ryung Uh <span dir="ltr"><<a href="mailto:guh@boisestate.edu" target="_blank">guh@boisestate.edu</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
<div><div></div><div class="h5">
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></div></div>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">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>
</blockquote></div><br><br clear="all"><br>-- <br>Gang-Ryung Uh, Associate Professor<br>Department of Computer Science<br>College of Engineering, Boise State Univerisity<br>tel: 1 208 426-5691  <a href="mailto:e-mail%3Aguh@boisestate.edu">e-mail:guh@boisestate.edu</a><br>
<a href="http://cs.boisestate.edu/~uh">http://cs.boisestate.edu/~uh</a><br><br><br>
</div>