MachineDominanceFrontier.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- llvm/CodeGen/MachineDominanceFrontier.h ------------------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_CODEGEN_MACHINEDOMINANCEFRONTIER_H
  14. #define LLVM_CODEGEN_MACHINEDOMINANCEFRONTIER_H
  15. #include "llvm/Analysis/DominanceFrontier.h"
  16. #include "llvm/Analysis/DominanceFrontierImpl.h"
  17. #include "llvm/CodeGen/MachineBasicBlock.h"
  18. #include "llvm/CodeGen/MachineFunctionPass.h"
  19. #include "llvm/Support/GenericDomTree.h"
  20. namespace llvm {
  21. class MachineDominanceFrontier : public MachineFunctionPass {
  22. ForwardDominanceFrontierBase<MachineBasicBlock> Base;
  23. public:
  24. using DomTreeT = DomTreeBase<MachineBasicBlock>;
  25. using DomTreeNodeT = DomTreeNodeBase<MachineBasicBlock>;
  26. using DomSetType = DominanceFrontierBase<MachineBasicBlock, false>::DomSetType;
  27. using iterator = DominanceFrontierBase<MachineBasicBlock, false>::iterator;
  28. using const_iterator =
  29. DominanceFrontierBase<MachineBasicBlock, false>::const_iterator;
  30. MachineDominanceFrontier(const MachineDominanceFrontier &) = delete;
  31. MachineDominanceFrontier &operator=(const MachineDominanceFrontier &) = delete;
  32. static char ID;
  33. MachineDominanceFrontier();
  34. ForwardDominanceFrontierBase<MachineBasicBlock> &getBase() { return Base; }
  35. const SmallVectorImpl<MachineBasicBlock *> &getRoots() const {
  36. return Base.getRoots();
  37. }
  38. MachineBasicBlock *getRoot() const {
  39. return Base.getRoot();
  40. }
  41. bool isPostDominator() const {
  42. return Base.isPostDominator();
  43. }
  44. iterator begin() {
  45. return Base.begin();
  46. }
  47. const_iterator begin() const {
  48. return Base.begin();
  49. }
  50. iterator end() {
  51. return Base.end();
  52. }
  53. const_iterator end() const {
  54. return Base.end();
  55. }
  56. iterator find(MachineBasicBlock *B) {
  57. return Base.find(B);
  58. }
  59. const_iterator find(MachineBasicBlock *B) const {
  60. return Base.find(B);
  61. }
  62. iterator addBasicBlock(MachineBasicBlock *BB, const DomSetType &frontier) {
  63. return Base.addBasicBlock(BB, frontier);
  64. }
  65. void removeBlock(MachineBasicBlock *BB) {
  66. return Base.removeBlock(BB);
  67. }
  68. void addToFrontier(iterator I, MachineBasicBlock *Node) {
  69. return Base.addToFrontier(I, Node);
  70. }
  71. void removeFromFrontier(iterator I, MachineBasicBlock *Node) {
  72. return Base.removeFromFrontier(I, Node);
  73. }
  74. bool compareDomSet(DomSetType &DS1, const DomSetType &DS2) const {
  75. return Base.compareDomSet(DS1, DS2);
  76. }
  77. bool compare(DominanceFrontierBase<MachineBasicBlock, false> &Other) const {
  78. return Base.compare(Other);
  79. }
  80. bool runOnMachineFunction(MachineFunction &F) override;
  81. void releaseMemory() override;
  82. void getAnalysisUsage(AnalysisUsage &AU) const override;
  83. };
  84. } // end namespace llvm
  85. #endif // LLVM_CODEGEN_MACHINEDOMINANCEFRONTIER_H
  86. #ifdef __GNUC__
  87. #pragma GCC diagnostic pop
  88. #endif