MachineDominanceFrontier.cpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. #include "llvm/InitializePasses.h"
  13. using namespace llvm;
  14. namespace llvm {
  15. template class DominanceFrontierBase<MachineBasicBlock, false>;
  16. template class DominanceFrontierBase<MachineBasicBlock, true>;
  17. template class ForwardDominanceFrontierBase<MachineBasicBlock>;
  18. }
  19. char MachineDominanceFrontier::ID = 0;
  20. INITIALIZE_PASS_BEGIN(MachineDominanceFrontier, "machine-domfrontier",
  21. "Machine Dominance Frontier Construction", true, true)
  22. INITIALIZE_PASS_DEPENDENCY(MachineDominatorTree)
  23. INITIALIZE_PASS_END(MachineDominanceFrontier, "machine-domfrontier",
  24. "Machine Dominance Frontier Construction", true, true)
  25. MachineDominanceFrontier::MachineDominanceFrontier() : MachineFunctionPass(ID) {
  26. initializeMachineDominanceFrontierPass(*PassRegistry::getPassRegistry());
  27. }
  28. char &llvm::MachineDominanceFrontierID = MachineDominanceFrontier::ID;
  29. bool MachineDominanceFrontier::runOnMachineFunction(MachineFunction &) {
  30. releaseMemory();
  31. Base.analyze(getAnalysis<MachineDominatorTree>().getBase());
  32. return false;
  33. }
  34. void MachineDominanceFrontier::releaseMemory() {
  35. Base.releaseMemory();
  36. }
  37. void MachineDominanceFrontier::getAnalysisUsage(AnalysisUsage &AU) const {
  38. AU.setPreservesAll();
  39. AU.addRequired<MachineDominatorTree>();
  40. MachineFunctionPass::getAnalysisUsage(AU);
  41. }