MachineDominators.cpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //===- MachineDominators.cpp - Machine Dominator Calculation --------------===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. //
  10. // This file implements simple dominator construction algorithms for finding
  11. // forward dominators on machine functions.
  12. //
  13. //===----------------------------------------------------------------------===//
  14. #include "llvm/CodeGen/MachineDominators.h"
  15. #include "llvm/CodeGen/Passes.h"
  16. using namespace llvm;
  17. TEMPLATE_INSTANTIATION(class DomTreeNodeBase<MachineBasicBlock>);
  18. TEMPLATE_INSTANTIATION(class DominatorTreeBase<MachineBasicBlock>);
  19. char MachineDominatorTree::ID = 0;
  20. static RegisterPass<MachineDominatorTree>
  21. E("machinedomtree", "MachineDominator Tree Construction", true);
  22. const PassInfo *const llvm::MachineDominatorsID = &E;
  23. void MachineDominatorTree::getAnalysisUsage(AnalysisUsage &AU) const {
  24. AU.setPreservesAll();
  25. MachineFunctionPass::getAnalysisUsage(AU);
  26. }
  27. bool MachineDominatorTree::runOnMachineFunction(MachineFunction &F) {
  28. DT->recalculate(F);
  29. return false;
  30. }
  31. MachineDominatorTree::MachineDominatorTree()
  32. : MachineFunctionPass(intptr_t(&ID)) {
  33. DT = new DominatorTreeBase<MachineBasicBlock>(false);
  34. }
  35. MachineDominatorTree::~MachineDominatorTree() {
  36. DT->releaseMemory();
  37. delete DT;
  38. }
  39. void MachineDominatorTree::releaseMemory() {
  40. DT->releaseMemory();
  41. }