<div dir="ltr">Bruce, Thank you so much for your help. Now it's clear to me. I am stuck in implementation phase of my project and I have many questions about LLVM. I apologize for my long and beginner level.questions.<div><br></div><div>I've seen many documents on cross-compiling. for example, I have a book named"Getting Started with LLVM</div><div>Core Libraries" It has described several pages on how to cross-compile and there is a document on <a href="http://llvm.org/docs/HowToCrossCompileLLVM.html">http://llvm.org/docs/HowToCrossCompileLLVM.html</a>. Which document and steps do you recommend? I had many problems in installing LLVM3.7 and I am worried that following wrong steps might mess with the LLVM tool and I have to go through installation again.</div><div><br></div><div>Also, I have another question. In my project I want to do some optimization on machine code, i.e, I want to write a pass before code emission phase. This pass reads machine instructions and do some optimizations on it. for example it tries to find all register dependencies. I want the input of my pass to be machine instructions in MIPS. Now my question is that, if I cross compile llvm for mips, then when I am running pass, will the input of my pass be in MIPS? I mean we run a pass on a bitcode (whithout running the llc mrach=MIPS), and bitcode is target independant. How LLVM knows it should be cross compile to MIPS not x86?</div><div><br></div><div>Regards,</div><div>Fami</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 3, 2015 at 3:48 AM, Bruce Hoult <span dir="ltr"><<a href="mailto:bruce@hoult.org" target="_blank">bruce@hoult.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">llc will make an object file with MIPS machine code for only the functions in your test.bc. You then need to link it with any MIPS libraries it needs (usually at least the C runtime library that calls main() for you etc).<div><br></div><div>The generated code will have exactly the data types (e.g. integer sizes) and struct layouts specified in your test.bc. These might or might not be correct for MIPS. If you're running on bare hardware then it's probably ok, but if you call library functions then you need to be laying out the data in the correct way. If you wrote test.bc yourself then that's your job, but usually it's the job of e.g. clang, and you need to also tell clang that you're compiling for MIPS (and which ABI) so it does that correctly.</div><div><br></div><div>A random .bc file for a similar enough machine might work -- same sizes, same padding rules and so forth. But unless you know for sure those are the same then chances are good that it won't work.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Mon, Nov 2, 2015 at 11:37 PM, fateme Hoseini via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><span style="color:rgb(69,77,75);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px;background-color:rgb(250,249,245)">Hi everyone, </span><br style="color:rgb(69,77,75);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px;background-color:rgb(250,249,245)"><span style="color:rgb(69,77,75);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px;background-color:rgb(250,249,245)">I am a new commer and I 'm tying to use LLVM to cross compile a code. I want to cross compile to MIPS and the host is the default x86. The more I read the document the more confused I get. I see documents on cross-compiling to ARM. But some install some gcc packages, while some use clang. I don't know where to start and how to do it. </span><br style="color:rgb(69,77,75);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px;background-color:rgb(250,249,245)"><span style="color:rgb(69,77,75);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px;background-color:rgb(250,249,245)">Is this just enough to run a command line like this: </span><br style="color:rgb(69,77,75);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px;background-color:rgb(250,249,245)"><br style="color:rgb(69,77,75);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px;background-color:rgb(250,249,245)"><span style="color:rgb(69,77,75);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px;background-color:rgb(250,249,245)">llc -march=mips test.bc -o testmips </span><br style="color:rgb(69,77,75);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px;background-color:rgb(250,249,245)"><br style="color:rgb(69,77,75);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px;background-color:rgb(250,249,245)"><span style="color:rgb(69,77,75);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px;background-color:rgb(250,249,245)">will the testmips file be executable for mips? </span><br style="color:rgb(69,77,75);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px;background-color:rgb(250,249,245)"><span style="color:rgb(69,77,75);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px;background-color:rgb(250,249,245)">I will appreciate if anyone help me with this problem. </span><br style="color:rgb(69,77,75);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px;background-color:rgb(250,249,245)"><span style="color:rgb(69,77,75);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px;background-color:rgb(250,249,245)">Thanks, </span><br style="color:rgb(69,77,75);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px;background-color:rgb(250,249,245)"><span style="color:rgb(69,77,75);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px;background-color:rgb(250,249,245)">Fami</span><br></div>
<br></div></div>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>