It probably depends a lot on the language ... clang (C / C ++) is able to get away, doing very little in terms of optimization in the interface. The only optimization I can think of to execute the generated code is that clang does some devirtualization of C ++ methods in the interface. clang performs some other optimizations, such as constantly folding and removing dead code, but this is mainly done to speed up the compilation process, and not for the performance of the generated code.
EDIT: Actually, thinking about this a bit more, I just remembered another important optimization task for C ++: clang knows a few tricks to use copy constructors in C ++ (google for NRVO).
In some cases, the IR optimization language pack may be useful. There is a SimplifyLibCalls pass that knows how to optimize calls to the standard C library. For the new Objective-C language feature, the ARC clang places some ARC ends in the pipeline; which optimize calls for various Objective-C time functions.
In general, the implementation of optimizations in the interface is generally useful when the code has properties that cannot be encoded in IR (for example, C ++ objects have a constant pointer vtable). And in practice, you most likely want to first implement the creation of silent code and see if there are important cases that are not optimized. Optimizers can perform some surprisingly complex conversions.
See also http://llvm.org/docs/tutorial/LangImpl7.html ; using alloca is one thing that helps optimizers significantly, although this is not optimization itself.
servn source share