LLVM API Documentation

MachinePostDominators.h
Go to the documentation of this file.
00001 //=- llvm/CodeGen/MachineDominators.h ----------------------------*- C++ -*-==//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file exposes interfaces to post dominance information for
00011 // target-specific code.
00012 //
00013 //===----------------------------------------------------------------------===//
00014 
00015 #ifndef LLVM_CODEGEN_MACHINEPOSTDOMINATORS_H
00016 #define LLVM_CODEGEN_MACHINEPOSTDOMINATORS_H
00017 
00018 #include "llvm/CodeGen/MachineDominators.h"
00019 #include "llvm/CodeGen/MachineFunctionPass.h"
00020 
00021 namespace llvm {
00022 
00023 ///
00024 /// PostDominatorTree Class - Concrete subclass of DominatorTree that is used
00025 /// to compute the post-dominator tree.
00026 ///
00027 struct MachinePostDominatorTree : public MachineFunctionPass {
00028 private:
00029   DominatorTreeBase<MachineBasicBlock> *DT;
00030 
00031 public:
00032   static char ID;
00033 
00034   MachinePostDominatorTree();
00035 
00036   ~MachinePostDominatorTree();
00037 
00038   FunctionPass *createMachinePostDominatorTreePass();
00039 
00040   const std::vector<MachineBasicBlock *> &getRoots() const {
00041     return DT->getRoots();
00042   }
00043 
00044   MachineDomTreeNode *getRootNode() const {
00045     return DT->getRootNode();
00046   }
00047 
00048   MachineDomTreeNode *operator[](MachineBasicBlock *BB) const {
00049     return DT->getNode(BB);
00050   }
00051 
00052   MachineDomTreeNode *getNode(MachineBasicBlock *BB) const {
00053     return DT->getNode(BB);
00054   }
00055 
00056   bool dominates(const MachineDomTreeNode *A,
00057                  const MachineDomTreeNode *B) const {
00058     return DT->dominates(A, B);
00059   }
00060 
00061   bool dominates(const MachineBasicBlock *A, const MachineBasicBlock *B) const {
00062     return DT->dominates(A, B);
00063   }
00064 
00065   bool properlyDominates(const MachineDomTreeNode *A,
00066                          const MachineDomTreeNode *B) const {
00067     return DT->properlyDominates(A, B);
00068   }
00069 
00070   bool properlyDominates(const MachineBasicBlock *A,
00071                          const MachineBasicBlock *B) const {
00072     return DT->properlyDominates(A, B);
00073   }
00074 
00075   MachineBasicBlock *findNearestCommonDominator(MachineBasicBlock *A,
00076                                                 MachineBasicBlock *B) {
00077     return DT->findNearestCommonDominator(A, B);
00078   }
00079 
00080   bool runOnMachineFunction(MachineFunction &MF) override;
00081   void getAnalysisUsage(AnalysisUsage &AU) const override;
00082   void print(llvm::raw_ostream &OS, const Module *M = nullptr) const override;
00083 };
00084 } //end of namespace llvm
00085 
00086 #endif