Thinking about a profile-guided LTO inliner

I'm new to llvm, but plan to implement a profile-guided link-time
function inliner as part of my research. So far I've been reading
through a lot of the docs and some of the source, and have a few
questions that are hopefully fairly high-level and easily answered by
someone who's actually gotten their hands dirty. Pointing me to a file
or document is a great answer for me at this point.

1. Since I don't want to look at callsites bottom-up through the
callgraph, (rather, think something like hottest-first), I believe I
should be using a ModulePass. Can I get confirmation that this is
indeed correct?

2. I have not seen anything to distinguish between compile-time and
link-time passes. Does such a distinction exist in llvm? Is it
possible to specify that a pass should only be run at link-time? If
not, can I fake it (eg, command line) for the purposes of my research?

3. Is there a way for a pass to query which actual analysis was used
from an analysis group? e.g., don't bother doing much if the alias
analysis was BasicAA.

4. I've gotten the impression that the pass manager looks at the
prereqs for each pass and then automatically determines a schedule for
running the passes; i.e., there is no explicit ordering of passes
spelled out in a source file somewhere. That's pretty cool, but does
that mean that ordering constrains of the form "X is more effective
after Y" need to be expressed by prereqs, even if there isn't a real
dependence between them? How do you specify that a transformation
should be done multiple times? (eg, do Y immediately before X, then do Y
again later. Y could be something like constant propagation. X does
not invalidate Y, and nothing after X might need Y, but it might still
be beneficial to do Y again...)

Thanks for pointing me in the right directions!