[LLVMdev] LLVM related question

Rotem Varon varonrotem at gmail.com
Sat May 9 08:37:57 PDT 2009


I will start with that i am vary grateful for your time.And continue with, i
am sorry if my Qs aren't quite accurate( i just started with the LLVM
compiler).

On Sat, May 9, 2009 at 5:23 PM, Eli Friedman <eli.friedman at gmail.com> wrote:

> On Sat, May 9, 2009 at 5:35 AM, Rotem Varon <varonrotem at gmail.com> wrote:
> > I need to add a new optimization to the LLVM compiler.
>
> Knowing what the optimization does would be very helpful here.
>
> > The optimization ALREADY written for x86 IR (i mean that the code that
> > handles the optimization is designated to work on assembly 86) .
>
> It's designed to work on x86 assembly, or "x86 IR"?

Its not x86 IR nor  x86 assembly. I have x86 IR "like" instructions ( add
R1, R2, R3    and so...)

>  If it's really
> x86 assembly, you can use LLVM's code generator to get x86 assembly,

Do you mean the "llvm-gcc -S file.c" , or can i have the same effect with
C++ code (API) ?

> but it's extremely difficult to get back to LLVM IR.

Please, its vary important for me that you elaborate why it will
be extremely difficult ( i can imagine it would hard, but if you inlight me
i would probably create a better design...)?

>  If it's
> something higher-level, it might not be so bad.

 Do you mean, higher than IR ? like c or C++ code ...

>
>
> > So, this is what i think -
> > I will add a Basic Block Pass to the LLVM, the code of the pass will
> iterate
> > etch instruction and convert it to x86 IR, now the optimization will take
> > place, after the optimization i will convert the x86 IR code back into
> LLVM
> > IR.
> > To the question(s):
> > Do you think my idea is a good one (if yes, do you see any
> > problems implementing this)?
> > Do you have another idea?
>
> If you're going to need conversions both ways, my guess is that it'll
> be faster to just rewrite the pass as an LLVM IR pass.

Can you tall me where can i fined more information about the  LLVM IR pass?

>  It depends on
> how complicated the pass is, though.

Lets say its only a project (academic)  ...

> > Is the LLVM have such built in capability ( converting LLVM IR
> to other IRs
> > ) ?
>
> If you need a different IR, I think you'll have to write your own
> converter.  Converting from LLVM IR to another language generally
> isn't very difficult if you don't care about the quality of the
> generated code too much,

Again, lets say its only a project (academic)  ...

> but it's a lot of work, and it seems like
> code quality is important here.
>
> -Eli

If i have a pointer to Instruction, how can i get or set the VALUE of
Instruction's
operands ?

Thank you.

>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090509/3853c8b1/attachment.html>


More information about the llvm-dev mailing list