]> git.proxmox.com Git - rustc.git/blob - src/llvm/include/llvm/CodeGen/MachinePostDominators.h
Imported Upstream version 0.6
[rustc.git] / src / llvm / include / llvm / CodeGen / MachinePostDominators.h
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
15 #ifndef LLVM_CODEGEN_MACHINEPOSTDOMINATORS_H
16 #define LLVM_CODEGEN_MACHINEPOSTDOMINATORS_H
17
18 #include "llvm/CodeGen/MachineFunctionPass.h"
19 #include "llvm/CodeGen/MachineDominators.h"
20 #include "llvm/Analysis/Dominators.h"
21 #include "llvm/Analysis/DominatorInternals.h"
22
23 namespace llvm {
24
25 ///
26 /// PostDominatorTree Class - Concrete subclass of DominatorTree that is used
27 /// to compute the a post-dominator tree.
28 ///
29 struct MachinePostDominatorTree : public MachineFunctionPass {
30 private:
31 DominatorTreeBase<MachineBasicBlock> *DT;
32
33 public:
34 static char ID;
35
36 MachinePostDominatorTree();
37
38 ~MachinePostDominatorTree();
39
40 FunctionPass *createMachinePostDominatorTreePass();
41
42 const std::vector<MachineBasicBlock *> &getRoots() const {
43 return DT->getRoots();
44 }
45
46 MachineDomTreeNode *getRootNode() const {
47 return DT->getRootNode();
48 }
49
50 MachineDomTreeNode *operator[](MachineBasicBlock *BB) const {
51 return DT->getNode(BB);
52 }
53
54 MachineDomTreeNode *getNode(MachineBasicBlock *BB) const {
55 return DT->getNode(BB);
56 }
57
58 bool dominates(MachineDomTreeNode *A, MachineDomTreeNode *B) const {
59 return DT->dominates(A, B);
60 }
61
62 bool dominates(MachineBasicBlock *A, MachineBasicBlock *B) const {
63 return DT->dominates(A, B);
64 }
65
66 bool
67 properlyDominates(const MachineDomTreeNode *A, MachineDomTreeNode *B) const {
68 return DT->properlyDominates(A, B);
69 }
70
71 bool
72 properlyDominates(MachineBasicBlock *A, MachineBasicBlock *B) const {
73 return DT->properlyDominates(A, B);
74 }
75
76 MachineBasicBlock *findNearestCommonDominator(MachineBasicBlock *A,
77 MachineBasicBlock *B) {
78 return DT->findNearestCommonDominator(A, B);
79 }
80
81 virtual bool runOnMachineFunction(MachineFunction &MF);
82 virtual void getAnalysisUsage(AnalysisUsage &AU) const;
83 virtual void print(llvm::raw_ostream &OS, const Module *M = 0) const;
84 };
85 } //end of namespace llvm
86
87 #endif