1 //===- PostDominators.cpp - Post-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 the post-dominator construction algorithms.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include "llvm/Analysis/PostDominators.h"
15 #include "llvm/ADT/DepthFirstIterator.h"
16 #include "llvm/ADT/SetOperations.h"
17 #include "llvm/IR/CFG.h"
18 #include "llvm/IR/Instructions.h"
19 #include "llvm/Support/Debug.h"
20 #include "llvm/Support/GenericDomTreeConstruction.h"
21 using namespace llvm;
22 
23 #define DEBUG_TYPE "postdomtree"
24 
25 //===----------------------------------------------------------------------===//
26 //  PostDominatorTree Implementation
27 //===----------------------------------------------------------------------===//
28 
29 char PostDominatorTree::ID = 0;
30 INITIALIZE_PASS(PostDominatorTree, "postdomtree",
31                 "Post-Dominator Tree Construction", true, true)
32 
runOnFunction(Function & F)33 bool PostDominatorTree::runOnFunction(Function &F) {
34   DT->recalculate(F);
35   return false;
36 }
37 
~PostDominatorTree()38 PostDominatorTree::~PostDominatorTree() {
39   delete DT;
40 }
41 
print(raw_ostream & OS,const Module *) const42 void PostDominatorTree::print(raw_ostream &OS, const Module *) const {
43   DT->print(OS);
44 }
45 
46 
createPostDomTree()47 FunctionPass* llvm::createPostDomTree() {
48   return new PostDominatorTree();
49 }
50 
51