[LLVMdev] libc dependencies, code generation questions

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Jun 7 03:58:18 PDT 2007


On 7 jun 2007, at 11:22, Duncan Sands wrote:

> I've been working on getting the gcc Ada front-end to work in llvm- 
> gcc.
> Since Ada evolved from Pascal, it may be worth your while to see how
> llvm-gcc handles these kinds of issues (most of the work is done in
> llvm-convert.cpp).

Thanks, I will certainly do so.

>> [llvm helpers such as malloc, free, memcpy, memset, fp  
>> helpers, ... ->
>>  taken from the standard C library?]
>
> I don't think LLVM spontaneously creates calls to these - it just  
> knows how
> to optimize them if the calls were already in the IR fed to it.

I don't really understand how it could do that. Does it simply look  
for declarations of functions with particular signatures and inserts  
calls to them?

>> 4) to what extent is the front end (i.e., our compiler) responsible
>> for code selection and optimization? In other words, should we spend
>> a lot of time on converting if-statements to select-based predicates
>> and things like this, or will this be done by llvm afterwards anyway?
>> What about vectorization? Are there particular kinds of optimizations
>> which llvm will probably never be very good at (or which are not
>> llvm's focus in the near to middle term), and which thus should
>> definitely be done at a higher level?
>
> In llvm-gcc, front-ends do very little optimization.

I actually did see gcc doing quite a bit of stuff when turning on  
optimizations and specifying -emit-llvm. At least it moved things  
from memory to (virtual) registers and factored common parts out of  
switch statements.

Thanks for your answer,


Jonas



More information about the llvm-dev mailing list