<div dir="ltr"><span class="Apple-style-span" style="color: rgb(51, 51, 255);">I will start with that i am vary grateful for your time.</span><div><span class="Apple-style-span" style="color: rgb(51, 51, 255);">And continue with, i am sorry if my Qs aren't quite accurate( i just started with the LLVM compiler). </span><br>
<br><div class="gmail_quote">On Sat, May 9, 2009 at 5:23 PM, Eli Friedman <span dir="ltr"><<a href="mailto:eli.friedman@gmail.com" target="_blank">eli.friedman@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div>On Sat, May 9, 2009 at 5:35 AM, Rotem Varon <<a href="mailto:varonrotem@gmail.com" target="_blank">varonrotem@gmail.com</a>> wrote:<br>
> I need to add a new optimization to the LLVM compiler.<br>
<br>
</div>Knowing what the optimization does would be very helpful here.<br>
<div><br>
> The optimization ALREADY written for x86 IR (i mean that the code that<br>
> handles the optimization is designated to work on assembly 86) .<br>
<br>
</div>It's designed to work on x86 assembly, or "x86 IR"?</blockquote><div><span style="color:rgb(51, 51, 255)">Its not x86 IR nor  x86 assembly. I have x86 IR "like" instructions ( add R1, R2, R3    and so...)</span></div>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">  If it's really<br>
x86 assembly, you can use LLVM's code generator to get x86 assembly,</blockquote><div><span class="Apple-style-span" style="color: rgb(51, 51, 255); ">Do you mean the "llvm-gcc -S file.c" , or can i have the same effect with C++ code (API) ?</span> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
but it's extremely difficult to get back to LLVM IR.</blockquote><div><span class="Apple-style-span" style="color: rgb(51, 51, 255);">Please, its vary important for me that you elaborate why it wil</span><span class="Apple-style-span" style="color: rgb(51, 51, 255);">l be extremely difficult ( i can imagine it would hard, but if you inlight me i would probably create a better design...)?</span></div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">  If it's<br>
something higher-level, it might not be so bad.</blockquote><div> <span class="Apple-style-span" style="color: rgb(51, 51, 255);">Do you mean, higher than IR ? like c or C++ code ...</span></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<div><br>
> So, this is what i think -<br>
> I will add a Basic Block Pass to the LLVM, the code of the pass will iterate<br>
> etch instruction and convert it to x86 IR, now the optimization will take<br>
> place, after the optimization i will convert the x86 IR code back into LLVM<br>
> IR.<br>
> To the question(s):<br>
> Do you think my idea is a good one (if yes, do you see any<br>
> problems implementing this)?<br>
> Do you have another idea?<br>
<br>
</div>If you're going to need conversions both ways, my guess is that it'll<br>
be faster to just rewrite the pass as an LLVM IR pass. </blockquote><div><span class="Apple-style-span" style="color: rgb(51, 51, 255);">Can you tall me where can i fined more information about the  LLVM IR pass? </span></div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> It depends on<br>
how complicated the pass is, though.</blockquote><div><span class="Apple-style-span" style="color: rgb(51, 51, 255);"><span class="Apple-style-span" style="color: rgb(0, 0, 0); "><span class="Apple-style-span" style="color: rgb(51, 51, 255); ">Lets say its only a project (academic)  ...</span> </span><br>
</span></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>
> Is the LLVM have such built in capability ( converting LLVM IR to other IRs<br>
> ) ?<br>
<br>
</div>If you need a different IR, I think you'll have to write your own<br>
converter.  Converting from LLVM IR to another language generally<br>
isn't very difficult if you don't care about the quality of the<br>
generated code too much,</blockquote><div><span class="Apple-style-span" style="color: rgb(51, 51, 255); ">Again, lets say its only a project (academic)  ...</span> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
 but it's a lot of work, and it seems like<br>
code quality is important here.<br>
<br>
-Eli</blockquote><div><span class="Apple-style-span" style="color: rgb(51, 51, 255);">If i have a pointer to Instruction, how can i get or set the VALUE of </span> <span class="Apple-style-span" style="color: rgb(51, 51, 255); ">Instruction's operands ?</span></div>
<div><span class="Apple-style-span" style="color: rgb(51, 51, 255);"><br></span></div><div><span class="Apple-style-span" style="color: rgb(51, 51, 255);">Thank you.</span></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
_______________________________________________<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>
</blockquote></div><br></div></div>