blob: 6ed27297923fc1b753d761cefa38d4a6591ee540 [file] [log] [blame]
Chris Lattner4c9df7c2002-08-02 16:43:03 +00001//===- PostDominators.cpp - Post-Dominator Calculation --------------------===//
Misha Brukman2b37d7c2005-04-21 21:13:18 +00002//
John Criswellb576c942003-10-20 19:43:21 +00003// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Misha Brukman2b37d7c2005-04-21 21:13:18 +00007//
John Criswellb576c942003-10-20 19:43:21 +00008//===----------------------------------------------------------------------===//
Chris Lattner17152292001-07-02 05:46:38 +00009//
Chris Lattner4c9df7c2002-08-02 16:43:03 +000010// This file implements the post-dominator construction algorithms.
Chris Lattner17152292001-07-02 05:46:38 +000011//
12//===----------------------------------------------------------------------===//
13
Owen Anderson1f23e162008-04-16 04:21:16 +000014#define DEBUG_TYPE "postdomtree"
15
Chris Lattnera69fd902002-08-21 23:43:50 +000016#include "llvm/Analysis/PostDominators.h"
Misha Brukman47b14a42004-07-29 17:30:56 +000017#include "llvm/Instructions.h"
Chris Lattner221d6882002-02-12 21:07:25 +000018#include "llvm/Support/CFG.h"
Owen Anderson1f23e162008-04-16 04:21:16 +000019#include "llvm/Support/Debug.h"
Reid Spencer551ccae2004-09-01 22:55:40 +000020#include "llvm/ADT/DepthFirstIterator.h"
21#include "llvm/ADT/SetOperations.h"
Chris Lattner9fc5cdf2011-01-02 22:09:33 +000022#include "llvm/Assembly/Writer.h"
Owen Anderson9cb7f492007-10-03 21:25:45 +000023#include "llvm/Analysis/DominatorInternals.h"
Chris Lattnercd7c2872003-12-07 00:35:42 +000024using namespace llvm;
Brian Gaeked0fde302003-11-11 22:41:34 +000025
Chris Lattner94108ab2001-07-06 16:58:22 +000026//===----------------------------------------------------------------------===//
Owen Anderson3dc67762007-04-15 08:47:27 +000027// PostDominatorTree Implementation
Nate Begeman442b32b2006-03-11 02:20:46 +000028//===----------------------------------------------------------------------===//
29
Devang Patel19974732007-05-03 01:11:54 +000030char PostDominatorTree::ID = 0;
Owen Andersond13db2c2010-07-21 22:09:45 +000031INITIALIZE_PASS(PostDominatorTree, "postdomtree",
Owen Andersonce665bd2010-10-07 22:25:06 +000032 "Post-Dominator Tree Construction", true, true)
Nate Begeman442b32b2006-03-11 02:20:46 +000033
Owen Anderson471ab542007-10-03 03:20:17 +000034bool PostDominatorTree::runOnFunction(Function &F) {
Owen Andersond20cc142007-10-23 20:58:37 +000035 DT->recalculate(F);
Owen Anderson471ab542007-10-03 03:20:17 +000036 return false;
37}
38
Chris Lattner791102f2009-08-23 05:17:37 +000039PostDominatorTree::~PostDominatorTree() {
Torok Edwinf6055802008-05-03 20:25:26 +000040 delete DT;
41}
42
Chris Lattner45cfe542009-08-23 06:03:38 +000043void PostDominatorTree::print(raw_ostream &OS, const Module *) const {
44 DT->print(OS);
Chris Lattner791102f2009-08-23 05:17:37 +000045}
46
47
Owen Anderson5771d6c2008-05-29 17:00:13 +000048FunctionPass* llvm::createPostDomTree() {
49 return new PostDominatorTree();
50}
51