would not have been exposed to either generic programming or programming languages to the level that I have. He has also shown me in detail how to perform research and write high-quality papers, and I am grateful to be able to benefit from his experience in these areas.I am also grateful to my mentor at Lawrence Livermore National Laboratory, Daniel Quinlan, for aid in creating the thesis and support in both software development and writing the thesis. The ROSE framework, of which he is the main developer, was invaluable in applying the work in this thesis to commonly used programming languages. On the other hand, software libraries have also been recognized as potentially aiding in program optimization. One proposed implementation of library-based optimization is to allow the library author, or a library user, to define custom analyses and optimizations. Only limited systems have been created to take advantage of this potential, however. One problem in creating a framework for defining new optimizations and analyses is how users are to specify them: implementing them by hand inside a compiler is difficult and prone to errors. Thus, a domain-specific language for librarybased compiler optimizations would be beneficial. Many optimization specification languages have appeared in the literature, but they tend to be either limited in power or unnecessarily difficult to use. Therefore, I have designed, implemented, and evaluated the Pavilion language for specifying program analyses and optimizations, designed for library authors and users. These analyses and optimizations can be based on the implementation of a particular library, its use in a specific program, or on the properties of a broad range of types, expressed through concepts. The new system is intended to provide a high level of expressiveness, even though the intended users are unlikely to be compiler experts.viii