On Fri, 2013-07-26 at 11:04 -0400, David Malcolm wrote: > This patch is the hand-written part of the conversion of passes from > C structs to C++ classes. It does not work without the subsequent > autogenerated part, which is huge. > > Given that the autogenerated part of the conversion is very large > (500k), for the sake of human comprehension I have kept the change as > two separate patches to keep the hand-written changes separate from the > automatically-generated ones. I would commit these as two separate > changes to SVN in order to keep this readability for posterity in the > logs as well as at review-time. > > This pair of patches eliminates the mutable global variables > representing the passes, allowing for multiple compilation contexts in > one process, potentially with different combinations of passes, and with > pass instance owning additional data. > > It converts the hierarchy of opt_pass types into an actual C++ class > hierarchy, where each of: > > * gimple_opt_pass > * rtl_opt_pass > * ipa_opt_pass_d > * simple_ipa_opt_pass > > all become subclasses of opt_pass. [...]
This looks good to me. I suggest adding into the `opt_pass` class two constant fields for the approximate source location of the pass, e.g. a field const char* _file; and another const unsigned _lineno; initialized with __FILE__ and __LINE__ respectively. This won't cost much (we don't have zillions of instances of opt_pass....) and would help a lot finding where (in which source file) an actual pass is. This is particularly useful for newbies writing plugins (which are trying to add new passes). It takes a lot of time to them to find which actual source file inside the compiler is implementing a given (existing) pass. Cheers -- Basile STARYNKEVITCH http://starynkevitch.net/Basile/ email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359 8, rue de la Faiencerie, 92340 Bourg La Reine, France *** opinions {are only mine, sont seulement les miennes} ***