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