blob: 7b5947ad45b61a68dd0888b5d2c6c457a299b457 [file] [log] [blame]
Chris Lattnerd43023a2002-08-02 16:43:03 +00001//===- PostDominators.cpp - Post-Dominator Calculation --------------------===//
Misha Brukman01808ca2005-04-21 21:13:18 +00002//
John Criswell482202a2003-10-20 19:43:21 +00003// The LLVM Compiler Infrastructure
4//
Chris Lattnerf3ebc3f2007-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 Brukman01808ca2005-04-21 21:13:18 +00007//
John Criswell482202a2003-10-20 19:43:21 +00008//===----------------------------------------------------------------------===//
Chris Lattner081aabc2001-07-02 05:46:38 +00009//
Chris Lattnerd43023a2002-08-02 16:43:03 +000010// This file implements the post-dominator construction algorithms.
Chris Lattner081aabc2001-07-02 05:46:38 +000011//
12//===----------------------------------------------------------------------===//
13
Owen Anderson57236b52008-04-16 04:21:16 +000014#define DEBUG_TYPE "postdomtree"
15
Chris Lattnerc86203a2002-08-21 23:43:50 +000016#include "llvm/Analysis/PostDominators.h"
Chandler Carruthed0881b2012-12-03 16:50:05 +000017#include "llvm/ADT/DepthFirstIterator.h"
18#include "llvm/ADT/SetOperations.h"
19#include "llvm/Analysis/DominatorInternals.h"
20#include "llvm/Assembly/Writer.h"
Misha Brukman63b38bd2004-07-29 17:30:56 +000021#include "llvm/Instructions.h"
Chris Lattner60a65912002-02-12 21:07:25 +000022#include "llvm/Support/CFG.h"
Owen Anderson57236b52008-04-16 04:21:16 +000023#include "llvm/Support/Debug.h"
Chris Lattnerf9f7c2d2003-12-07 00:35:42 +000024using namespace llvm;
Brian Gaeke960707c2003-11-11 22:41:34 +000025
Chris Lattnerc385beb2001-07-06 16:58:22 +000026//===----------------------------------------------------------------------===//
Owen Andersonf35a1db2007-04-15 08:47:27 +000027// PostDominatorTree Implementation
Nate Begemand5811b92006-03-11 02:20:46 +000028//===----------------------------------------------------------------------===//
29
Devang Patel8c78a0b2007-05-03 01:11:54 +000030char PostDominatorTree::ID = 0;
Owen Andersona57b97e2010-07-21 22:09:45 +000031INITIALIZE_PASS(PostDominatorTree, "postdomtree",
Owen Andersondf7a4f22010-10-07 22:25:06 +000032 "Post-Dominator Tree Construction", true, true)
Nate Begemand5811b92006-03-11 02:20:46 +000033
Owen Andersonb60f2542007-10-03 03:20:17 +000034bool PostDominatorTree::runOnFunction(Function &F) {
Owen Anderson9c614112007-10-23 20:58:37 +000035 DT->recalculate(F);
Owen Andersonb60f2542007-10-03 03:20:17 +000036 return false;
37}
38
Chris Lattnerb1d782b2009-08-23 05:17:37 +000039PostDominatorTree::~PostDominatorTree() {
Torok Edwin2a455752008-05-03 20:25:26 +000040 delete DT;
41}
42
Chris Lattner13626022009-08-23 06:03:38 +000043void PostDominatorTree::print(raw_ostream &OS, const Module *) const {
44 DT->print(OS);
Chris Lattnerb1d782b2009-08-23 05:17:37 +000045}
46
47
Owen Andersonb1ba3522008-05-29 17:00:13 +000048FunctionPass* llvm::createPostDomTree() {
49 return new PostDominatorTree();
50}
51