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/CodeGen/MachineDominators.h"
  10. #include "llvm/CodeGen/Passes.h"
  11. #include "llvm/InitializePasses.h"
  12. #include "llvm/Pass.h"
  13. #include "llvm/PassRegistry.h"
  14. using namespace llvm;
  15. namespace llvm {
  16. template class DominanceFrontierBase<MachineBasicBlock, false>;
  17. template class DominanceFrontierBase<MachineBasicBlock, true>;
  18. template class ForwardDominanceFrontierBase<MachineBasicBlock>;
  19. }
  20. char MachineDominanceFrontier::ID = 0;
  21. INITIALIZE_PASS_BEGIN(MachineDominanceFrontier, "machine-domfrontier",
  22. "Machine Dominance Frontier Construction", true, true)
  23. INITIALIZE_PASS_DEPENDENCY(MachineDominatorTree)
  24. INITIALIZE_PASS_END(MachineDominanceFrontier, "machine-domfrontier",
  25. "Machine Dominance Frontier Construction", true, true)
  26. MachineDominanceFrontier::MachineDominanceFrontier() : MachineFunctionPass(ID) {
  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. }