We have introduced a system that allows libraries to be both general and efficient. Applications can use a library's most general interface, and our compiler can customize the library implementation for different application needs. The key to our solution is an annotation language that conveys domain-specific information to the Broadway Compiler. The cost is that of annotating libraries, but the benefits are many: (1) Our compiler can perform domain-specific optimizations that are not possible without annotations; (2) our approach supports the use of cleaner, simpler interfaces, which leads to application code that is easier to maintain; (3) our approach provides a clear separation of concerns, as optimization information is encapsulated in the annotations rather than embedded in the application source code. In effect, the annotation language allows our compiler to treat libraries as semantically-rich but syntactically poor languages.
We have tested our technique by applying it to two programs written using the PLAPACK library. Our experience shows that (1) pointer-based C code can be analyzed with the help of our annotations, (2) our technique can produce significant performance improvements, even for a library that has already been carefully designed to achieve good performance, (3) a small number of simple annotations can be effective, and (4) the same set of annotations can be used to optimize multiple applications.
This work can be extended in many directions. When our compiler implementation is complete we will apply our transformations uniformly to a wider body of PLAPACK routines and a larger number of PLAPACK applications. We also plan to annotate other libraries, such as the standard math library, the MPICH  implementation of the Message Passing Interface, and perhaps Open GL . More fundamentally, we are developing compilation strategies that allow us to optimize across multiple layers of libraries, and we are also exploring ways to extend our annotation language to support machine-specific customization.