Minor pass manager related question about where to put header files...

So the new pass manager makes passes just be classes that implement a particular interface. And in the spirit of having boring and unsurprising patterns, there really is nothing more to it than that. No memory allocation is required, and passes will, by default, be “utilities” which can be run directly and on their own.

However, this raises an interesting question. Where should the pass headers go? They need to be visible to library consumers in order to build up their own interesting pass pipelines. For example, I plan to eventually wrap the functionality I’ve been building for the new pass manager in the ‘opt’ tool into a library, and then its low-tech pass registration system will need to include all the headers for all the passes in order to instantiate them for particular pass pipelines.

My inclination is to just do the unsurprising thing and mirror the Transforms lib structure under include/llvm with per-pass header files. Does anyone see problems with this? Concerns they’d like to make sure are addressed now?

I ask this now because I’m ready to port the first significant transform to the new pass manager. =] I have a patch that ports InstCombine, everything works, but I need a place to put the header.

-Chandler

Chandler Carruth <chandlerc@gmail.com> writes:

So the new pass manager makes passes just be classes that implement a
particular interface. And in the spirit of having boring and unsurprising
patterns, there really is nothing more to it than that. No memory allocation
is required, and passes will, by default, be "utilities" which can be run
directly and on their own.

However, this raises an interesting question. Where should the pass headers
go? They need to be visible to library consumers in order to build up their
own interesting pass pipelines. For example, I plan to eventually wrap the
functionality I've been building for the new pass manager in the 'opt' tool
into a library, and then its low-tech pass registration system will need to
include all the headers for all the passes in order to instantiate them for
particular pass pipelines.

My inclination is to just do the unsurprising thing and mirror the Transforms
lib structure under include/llvm with per-pass header files. Does anyone see
problems with this? Concerns they'd like to make sure are addressed now?

SGTM. The familiarity should make things easy to find, and I can't
think of a good reason to do something deliberately different.