Use new Pass Manager for CodeGen (new)


Charlie spent some time on using new Pass Manager for CodeGen in this summer.
( The initial
interface design is here I think Fedor asked
some questions that make perfect sense and I am trying to address these issues
in a new patch

(For high-level view of the new PM, Duncan's summary is a great start

In short, I think a machine function pass only pipeline should be able to perform
the CodeGen (currently SelectionDAGISel and AsmPrinter are both
MachineFunctionPass in legacy Pass Manager). There are no need for proxy or
adaptor classes since cross-IR unit activities like invalidation does not exist.
The new machine function pass could query either machine function analysis (
invalidation is possible) or IR unit analysis such as Module or Function analysis
(invalidation is not possible). Machine function analysis are exposed via the
interface AnalysisManager<MachineFunction>; IR unit analysis are exposed by
these managers that are used for Opt where some cached results are still valid
to reduce recomputation.

The unit test in demonstrates the expected usage
of this new interface.

Does this interface look complete for the purpose of CodeGen? Are there some other
pieces you think should be here? Any comments and suggestions are greatly appreciated.

- Yuanfang