deleting passes/cloning pass manager


I'm wondering what the best way to remove some passes from a
PassManager object (either an existing PassManager object or cloning
an existing one removing passes)? I'm not sure whether the TODO
comment in FunctionPassManager refers to implementing
removing-and-deleting in the future or is just talking about
preventing leaks deleting.

Why I want to do this is that I'm trying to implement
timing-test-based scheduling and it looks like the best way to do that
is by running only the passes from RegAlloc onwards on a preprepared
structure. In principle I could try and determine which passes are
added in standard JIT creation and explicitly add them in new pass
managers, but the JIT appears to add it's internal passes spread over
various places rather than concentrated in one place so that's complex
and prone to break if the JIT code changes without me spotting it.

Many thanks for any assistance,
David Steven Tweed