Zephyr Compiler Infrastructure provides a means to define an intermediate representation and write passes on it in several languages; it also provides a hardware description language to power a code-generator generator. From the web site:
If you describe your intermediate forms using Zephyr’s Abstract Syntax Description Language (ASDL), we can generate data-structure definitions in C, C++, Java, Standard ML, and Haskell. Your IR can be serialized on disk and freely exchanged among compiler passes written in these languages…
[Zephyr] generate[s] the machine-dependent parts from descriptions of instructions’ semantics, of binary representations, or of other properties. Zephyr’s Computer Systems Description Languages (CSDL) let you describe as much or as little as you need for your application.
Zephyr also seems to provide a reasonable set of built-in optimizations.