runtime optimizations in LLVM

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

runtime optimizations in LLVM

Kamal R. Prasad
Hello,

 (im new to LLVM , so pl excuse if this is a naive q).

  Can someone provide info on what runtime
optimizations are done in LLVM? do you have something
along lines of JVM's hotspot feature?

 How efficient is the optimized code vis-a-vis native
code?

thanks
-kamal
 




      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page.
http://www.yahoo.com/r/hs
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: runtime optimizations in LLVM

Gordon Henriksen-3
Hi Kamal,

On Jan 2, 2008, at 05:57, Kamal R. Prasad wrote:

> (im new to LLVM , so pl excuse if this is a naive q).

Welcome!

> Can someone provide info on what runtime optimizations are done in  
> LLVM?

You can use any of LLVM's optimizing transformations in a JIT context.  
There's a list here:

http://llvm.org/docs/Passes.html

Unlike Java, you're in the driver's seat. You can determine which  
optimizations are applied to your code, and when.

> do you have something along lines of JVM's hotspot feature?

You can recompile a function in the JIT at any time.

http://llvm.org/doxygen/classllvm_1_1ExecutionEngine.html#a18

However, LLVM does not yet have support frame rewriting; you cannot re-
optimize and resume a function that is on the call stack.

> How efficient is the optimized code vis-a-vis native code?

It is native code! :) LLVM is also an excellent static compiler (see  
llvm-gcc, clang).

— Gordon


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: runtime optimizations in LLVM

Kamal R. Prasad



--- On Thu, 1/3/08, Gordon Henriksen <[hidden email]> wrote:
>
> On Jan 2, 2008, at 05:57, Kamal R. Prasad wrote:
>
> > (im new to LLVM , so pl excuse if this is a naive q).
>
> Welcome!
>
thanks

> > Can someone provide info on what runtime optimizations
> are done in  
> > LLVM?
>
> You can use any of LLVM's optimizing transformations in
> a JIT context.  
> There's a list here:
>

> http://llvm.org/docs/Passes.html
>
> Unlike Java, you're in the driver's seat. You can
> determine which  
> optimizations are applied to your code, and when.
>

yes -but can you tell me which optimizations have been proven to be more effective when applied at run time i.e. when input data is available?

> > do you have something along lines of JVM's hotspot
> feature?
>
> You can recompile a function in the JIT at any time.
>
I am interested in optimizing code that was compiled using a C/C++ compiler. So, I will have binaries but probably not the source code.

> http://llvm.org/doxygen/classllvm_1_1ExecutionEngine.html#a18
>
> However, LLVM does not yet have support frame rewriting;
> you cannot re-
> optimize and resume a function that is on the call stack.
>
> > How efficient is the optimized code vis-a-vis native
> code?
>
> It is native code! :) LLVM is also an excellent static
> compiler (see  
> llvm-gcc, clang).
>
can I pull out the backend part which is used for runtime optimization?

thanks
kamal

> — Gordon


     

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: runtime optimizations in LLVM

Gordon Henriksen-3

On 2008-07-07, at 01:12, Kamal R. Prasad wrote:

> On Thu, 1/3/08, Gordon Henriksen <[hidden email]> wrote:
>>
>
>> On Jan 2, 2008, at 05:57, Kamal R. Prasad wrote:
>>
>>> Can someone provide info on what runtime optimizations are done in  
>>> LLVM?
>>
>> You can use any of LLVM's optimizing transformations in a JIT  
>> context. There's a list here:
>>
>> http://llvm.org/docs/Passes.html
>>
>> Unlike Java, you're in the driver's seat. You can determine which  
>> optimizations are applied to your code, and when.
>
> yes -but can you tell me which optimizations have been proven to be  
> more effective when applied at run time i.e. when input data is  
> available?

LLVM's 'opt' tool supports a -std-compile-opts flag which runs a  
generic list of optimizations; this is a good starting point for  
aggressive optimizations, and you can access the same list  
programmatically. The problem of pass ordering is a nontrivial one,  
however, and only you can decide what is the best tradeoff for your  
application. Luckily, experimentation with passes is not especially  
difficult.

>>> do you have something along lines of JVM's hotspot feature?
>>
>> You can recompile a function in the JIT at any time.
>>
>
> I am interested in optimizing code that was compiled using a C/C++  
> compiler. So, I will have binaries but probably not the source code.

You must have LLVM IR (possibly in the form of bitcode files) to  
optimize using LLVM; LLVM cannot re-optimize native binaries. Search  
the archives for llvm-qemu to find information on the topic of binary  
translation/optimization using LLVM.

However, you can certainly reoptimize bitcode files without access to  
the source code.

>>> How efficient is the optimized code vis-a-vis native code?
>>
>> It is native code! :) LLVM is also an excellent static compiler  
>> (see llvm-gcc, clang).
>>
>
> can I pull out the backend part which is used for runtime  
> optimization?


These are the exact same components used for static optimization.  
Certainly, however, you can link with subsets of LLVM in order to  
reduce the size of your binary.

— Gordon


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev