MachineDominanceFrontier.cpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //===- MachineDominanceFrontier.cpp ---------------------------------------===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. #include "llvm/CodeGen/MachineDominanceFrontier.h"
  9. #include "llvm/Analysis/DominanceFrontierImpl.h"
  10. #include "llvm/CodeGen/MachineDominators.h"
  11. #include "llvm/CodeGen/Passes.h"
  12. using namespace llvm;
  13. namespace llvm {
  14. template class DominanceFrontierBase<MachineBasicBlock, false>;
  15. template class DominanceFrontierBase<MachineBasicBlock, true>;
  16. template class ForwardDominanceFrontierBase<MachineBasicBlock>;
  17. }
  18. char MachineDominanceFrontier::ID = 0;
  19. INITIALIZE_PASS_BEGIN(MachineDominanceFrontier, "machine-domfrontier",
  20. "Machine Dominance Frontier Construction", true, true)
  21. INITIALIZE_PASS_DEPENDENCY(MachineDominatorTree)
  22. INITIALIZE_PASS_END(MachineDominanceFrontier, "machine-domfrontier",
  23. "Machine Dominance Frontier Construction", true, true)
  24. MachineDominanceFrontier::MachineDominanceFrontier()
  25. : MachineFunctionPass(ID),
  26. Base() {
  27. initializeMachineDominanceFrontierPass(*PassRegistry::getPassRegistry());
  28. }
  29. char &llvm::MachineDominanceFrontierID = MachineDominanceFrontier::ID;
  30. bool MachineDominanceFrontier::runOnMachineFunction(MachineFunction &) {
  31. releaseMemory();
  32. Base.analyze(getAnalysis<MachineDominatorTree>().getBase());
  33. return false;
  34. }
  35. void MachineDominanceFrontier::releaseMemory() {
  36. Base.releaseMemory();
  37. }
  38. void MachineDominanceFrontier::getAnalysisUsage(AnalysisUsage &AU) const {
  39. AU.setPreservesAll();
  40. AU.addRequired<MachineDominatorTree>();
  41. MachineFunctionPass::getAnalysisUsage(AU);
  42. }