Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
2.4 KiB

  1. //=- llvm/CodeGen/MachineDominators.h ----------------------------*- C++ -*-==//
  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 exposes interfaces to post dominance information for
  11. // target-specific code.
  12. //
  13. //===----------------------------------------------------------------------===//
  14. #ifndef LLVM_CODEGEN_MACHINEPOSTDOMINATORS_H
  15. #define LLVM_CODEGEN_MACHINEPOSTDOMINATORS_H
  16. #include "llvm/Analysis/Dominators.h"
  17. #include "llvm/CodeGen/MachineDominators.h"
  18. #include "llvm/CodeGen/MachineFunctionPass.h"
  19. namespace llvm {
  20. ///
  21. /// PostDominatorTree Class - Concrete subclass of DominatorTree that is used
  22. /// to compute the a post-dominator tree.
  23. ///
  24. struct MachinePostDominatorTree : public MachineFunctionPass {
  25. private:
  26. DominatorTreeBase<MachineBasicBlock> *DT;
  27. public:
  28. static char ID;
  29. MachinePostDominatorTree();
  30. ~MachinePostDominatorTree();
  31. FunctionPass *createMachinePostDominatorTreePass();
  32. const std::vector<MachineBasicBlock *> &getRoots() const {
  33. return DT->getRoots();
  34. }
  35. MachineDomTreeNode *getRootNode() const {
  36. return DT->getRootNode();
  37. }
  38. MachineDomTreeNode *operator[](MachineBasicBlock *BB) const {
  39. return DT->getNode(BB);
  40. }
  41. MachineDomTreeNode *getNode(MachineBasicBlock *BB) const {
  42. return DT->getNode(BB);
  43. }
  44. bool dominates(const MachineDomTreeNode *A,
  45. const MachineDomTreeNode *B) const {
  46. return DT->dominates(A, B);
  47. }
  48. bool dominates(const MachineBasicBlock *A, const MachineBasicBlock *B) const {
  49. return DT->dominates(A, B);
  50. }
  51. bool properlyDominates(const MachineDomTreeNode *A,
  52. const MachineDomTreeNode *B) const {
  53. return DT->properlyDominates(A, B);
  54. }
  55. bool properlyDominates(const MachineBasicBlock *A,
  56. const MachineBasicBlock *B) const {
  57. return DT->properlyDominates(A, B);
  58. }
  59. MachineBasicBlock *findNearestCommonDominator(MachineBasicBlock *A,
  60. MachineBasicBlock *B) {
  61. return DT->findNearestCommonDominator(A, B);
  62. }
  63. virtual bool runOnMachineFunction(MachineFunction &MF);
  64. virtual void getAnalysisUsage(AnalysisUsage &AU) const;
  65. virtual void print(llvm::raw_ostream &OS, const Module *M = 0) const;
  66. };
  67. } //end of namespace llvm
  68. #endif