summaryrefslogtreecommitdiff
path: root/lib/CodeGen/MachinePostDominators.cpp
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2012-09-17 14:08:37 +0000
committerTom Stellard <thomas.stellard@amd.com>2012-09-17 14:08:37 +0000
commita52c3acc14062a7c2220cedb9f75531bf730eda8 (patch)
tree7b850395aa1bc0c80f36e5022e9748da2401106f /lib/CodeGen/MachinePostDominators.cpp
parent9b7ca410621f6988b2d4203b90058dd4252848a8 (diff)
downloadllvm-a52c3acc14062a7c2220cedb9f75531bf730eda8.tar.gz
llvm-a52c3acc14062a7c2220cedb9f75531bf730eda8.tar.bz2
llvm-a52c3acc14062a7c2220cedb9f75531bf730eda8.tar.xz
Add a MachinePostDominator pass
This is used in the AMDIL and R600 backends. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164029 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachinePostDominators.cpp')
-rw-r--r--lib/CodeGen/MachinePostDominators.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/lib/CodeGen/MachinePostDominators.cpp b/lib/CodeGen/MachinePostDominators.cpp
new file mode 100644
index 0000000000..c3f6e9249e
--- /dev/null
+++ b/lib/CodeGen/MachinePostDominators.cpp
@@ -0,0 +1,55 @@
+//===- MachinePostDominators.cpp -Machine Post Dominator Calculation ------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements simple dominator construction algorithms for finding
+// post dominators on machine functions.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/CodeGen/MachinePostDominators.h"
+
+using namespace llvm;
+
+char MachinePostDominatorTree::ID = 0;
+
+//declare initializeMachinePostDominatorTreePass
+INITIALIZE_PASS(MachinePostDominatorTree, "machinepostdomtree",
+ "MachinePostDominator Tree Construction", true, true)
+
+MachinePostDominatorTree::MachinePostDominatorTree() : MachineFunctionPass(ID) {
+ initializeMachinePostDominatorTreePass(*PassRegistry::getPassRegistry());
+ DT = new DominatorTreeBase<MachineBasicBlock>(true); //true indicate
+ // postdominator
+}
+
+FunctionPass *
+MachinePostDominatorTree::createMachinePostDominatorTreePass() {
+ return new MachinePostDominatorTree();
+}
+
+bool
+MachinePostDominatorTree::runOnMachineFunction(MachineFunction &F) {
+ DT->recalculate(F);
+ return false;
+}
+
+MachinePostDominatorTree::~MachinePostDominatorTree() {
+ delete DT;
+}
+
+void
+MachinePostDominatorTree::getAnalysisUsage(AnalysisUsage &AU) const {
+ AU.setPreservesAll();
+ MachineFunctionPass::getAnalysisUsage(AU);
+}
+
+void
+MachinePostDominatorTree::print(llvm::raw_ostream &OS, const Module *M) const {
+ DT->print(OS);
+}