[NewPM][CodeGen] Introduce machine pass and machine pass manager

Authored by ychen on Aug 7 2020, 9:24 AM.


[NewPM][CodeGen] Introduce machine pass and machine pass manager

machine pass could define four methods:

  • PreservedAnalyses run(MachineFunction &, MachineFunctionAnalysisManager &)
  • Error doInitialization(Module &, MachineFunctionAnalysisManager &)
  • Error doFinalization(Module &, MachineFunctionAnalysisManager &)
  • Error run(Module &, MachineFunctionAnalysisManager &)

machine pass manger:

  • MachineFunctionAnalysisManager: Basically an AnalysisManager<MachineFunction> augmented with the ability to register and query IR analyses
  • MachineFunctionPassManager: support only two methods, addPass and run

Reviewed By: arsenm, asbirlea, aeubanks

Differential Revision: https://reviews.llvm.org/D67687