Add some machinery for tracking optimization passes

There's now a generic way to track optimization passes.  Of course, I
need to actually write some of these... :).