<div dir="ltr"><span class="Apple-style-span" style="border-collapse: collapse; ">Thank your answer.</span><br><br><div class="gmail_quote">On Sun, May 10, 2009 at 5:39 PM, Rotem Varon <span dir="ltr"><<a href="mailto:varonrotem@gmail.com">varonrotem@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 dir="ltr">Thank you you answer.<div><div></div><div class="h5"><br><br><div class="gmail_quote">On Sun, May 10, 2009 at 12:48 AM, 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 8:37 AM, Rotem Varon <<a href="mailto:varonrotem@gmail.com" target="_blank">varonrotem@gmail.com</a>> wrote:<br>


> Its not x86 IR nor  x86 assembly. I have x86 IR "like" instructions ( add<br>
> R1, R2, R3    and so...)<br>
>><br>
>>  If it's really<br>
>> x86 assembly, you can use LLVM's code generator to get x86 assembly,<br>
><br>
> Do you mean the "llvm-gcc -S file.c" , or can i have the same effect with<br>
> C++ code (API) ?<br>
<br>
</div>Everything in LLVM is accessible through the C++ APIs.<br>
<div><br>
>> but it's extremely difficult to get back to LLVM IR.<br>
><br>
> Please, its vary important for me that you elaborate why it will<br>
> be extremely difficult ( i can imagine it would hard, but if you inlight me<br>
> i would probably create a better design...)?<br>
<br>
</div>A lot of information gets lost when converting to assembly, like<br>
types, switches, the SSA form, etc.  It's not impossible, especially<br>
if you make some assumptions about the compiler, but it's difficult<br>
enough that I wouldn't suggest it.  It looks like this doesn't apply<br>
here, though.<br>
<div><br>
>>  If it's<br>
>> something higher-level, it might not be so bad.<br>
><br>
>  Do you mean, higher than IR ? like c or C++ code ...<br>
<br>
</div>Your IR looks high-level enough that it wouldn't be so bad.  It would<br>
still be a pain to write, though.<br>
<div><br>
>> 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.<br>
><br>
> Can you tall me where can i fined more information about the  LLVM IR pass?<br>
<br>
</div><a href="http://llvm.org/docs/WritingAnLLVMPass.html" target="_blank">http://llvm.org/docs/WritingAnLLVMPass.html</a> . Also, a bunch of other<br>
stuff in <a href="http://llvm.org/docs/" target="_blank">http://llvm.org/docs/</a> is likely to be useful.<br>
<div><br>
>>  It depends on<br>
>> how complicated the pass is, though.<br>
><br>
> Lets say its only a project (academic)  ...<br>
<br>
</div>Then it's probably easier to rewrite as an LLVM IR pass.  There's less<br>
to worry about when you're not converting back and forth.<br>
<div><br>
> If i have a pointer to Instruction, how can i get or set the VALUE<br>
> of  Instruction's operands ?<br>
<br>
</div>I->getOperand(0) gets the first operand, I->setOperand(0) sets it,<br>
etc.  Note that in general, the best way to get used to the API is to<br>
look at existing passes, espcecially if there's already a pass that's<br>
does stuff that's related to what you're doing.<br>
<font color="#888888"><br>
-Eli<br>
</font><div><div></div><div><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>
</div></div></blockquote></div><br></div></div></div>
</blockquote></div><br></div>