MachineDominators.cpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. namespace llvm {
  18. TEMPLATE_INSTANTIATION(class DomTreeNodeBase<MachineBasicBlock>);
  19. TEMPLATE_INSTANTIATION(class DominatorTreeBase<MachineBasicBlock>);
  20. }
  21. char MachineDominatorTree::ID = 0;
  22. INITIALIZE_PASS(MachineDominatorTree, "machinedomtree",
  23. "MachineDominator Tree Construction", true, true);
  24. char &llvm::MachineDominatorsID = MachineDominatorTree::ID;
  25. void MachineDominatorTree::getAnalysisUsage(AnalysisUsage &AU) const {
  26. AU.setPreservesAll();
  27. MachineFunctionPass::getAnalysisUsage(AU);
  28. }
  29. bool MachineDominatorTree::runOnMachineFunction(MachineFunction &F) {
  30. DT->recalculate(F);
  31. return false;
  32. }
  33. MachineDominatorTree::MachineDominatorTree()
  34. : MachineFunctionPass(ID) {
  35. DT = new DominatorTreeBase<MachineBasicBlock>(false);
  36. }
  37. MachineDominatorTree::~MachineDominatorTree() {
  38. delete DT;
  39. }
  40. void MachineDominatorTree::releaseMemory() {
  41. DT->releaseMemory();
  42. }
  43. void MachineDominatorTree::print(raw_ostream &OS, const Module*) const {
  44. DT->print(OS);
  45. }