I like the idea that someone reviews the end destination you want to get to,
and the general path you want to use to get there, and then just pre-approve
the entire concept. :-) I think I like the end destination; the path you have
chosen is slightly different from the one I might have chosen, but the path
you've pick has the nice property that you can incrementally get to the end and
keep the tree working; so, likely is superior to the path I was thinking about.
The path I was thinking about, was to start by forming classes, and hoist the
data up into the classes, and get a this parameter passed around, then
something like n_basic_blocks in the code, becomes n_basic_blocks in the code,
with a implicit reference to the this parameter, or, to cfg->n_basic_blocks,
should the type of this not be cfg. Cause the transformations are just
identity, the disruption to the code is less (in some ways). However there is
a larger disruption in that all the functions quickly become member functions,
though, that also lies closer to the end result I had in mind as well.