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
Hi Jonas,> >> [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?it looks for functions with a certain name and signature, and supposes that these are the standard functions with those names. The simplify-libcalls pass does it.> >> 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.It is LLVM that is doing these optimizations. The LLVM optimizers are run before the LLVM IR is output. Ciao, Duncan.
Duncan Sands wrote:-> it looks for functions with a certain name and signature, and supposes > that these are the standard functions with those names.The way you write it makes this sound dubious. The way the standard is written, particularly w.r.t. external identifiers, makes this quite legitimate. Neil.
Possibly Parallel Threads
- [LLVMdev] libc dependencies, code generation questions
- [LLVMdev] libc dependencies, code generation questions
- [LLVMdev] libc dependencies, code generation questions
- [LLVMdev] libc dependencies, code generation questions
- [LLVMdev] libc dependencies, code generation questions