aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-05-07 18:51:25 +0000
committerChris Lattner <sabre@nondot.org>2002-05-07 18:51:25 +0000
commit64d1334ba79fc2367946053543b602408a19b559 (patch)
tree119a868de2f3e116728f88c5c20d3f0b5a381f19 /llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
parent445ec4e03298362f890841baeb49764125c415d5 (diff)
downloadllvm-64d1334ba79fc2367946053543b602408a19b559.zip
llvm-64d1334ba79fc2367946053543b602408a19b559.tar.gz
llvm-64d1334ba79fc2367946053543b602408a19b559.tar.bz2
Cleanup implementation a bit
llvm-svn: 2526
Diffstat (limited to 'llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp b/llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
index 37dc4ab..061cf3c 100644
--- a/llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
+++ b/llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
@@ -1,7 +1,9 @@
//===- UnifyFunctionExitNodes.cpp - Make all functions have a single exit -===//
//
-// This file provides several routines that are useful for simplifying CFGs in
-// various ways...
+// This pass is used to ensure that functions have at most one return
+// instruction in them. Additionally, it keeps track of which node is the new
+// exit node of the CFG. If there are no exit nodes in the CFG, the getExitNode
+// method will return a null pointer.
//
//===----------------------------------------------------------------------===//
@@ -22,7 +24,7 @@ AnalysisID UnifyFunctionExitNodes::ID(AnalysisID::create<UnifyFunctionExitNodes>
//
// If there are no return stmts in the Function, a null pointer is returned.
//
-bool UnifyFunctionExitNodes::doit(Function *M, BasicBlock *&ExitNode) {
+bool UnifyFunctionExitNodes::runOnFunction(Function *M) {
// Loop over all of the blocks in a function, tracking all of the blocks that
// return.
//
@@ -33,7 +35,7 @@ bool UnifyFunctionExitNodes::doit(Function *M, BasicBlock *&ExitNode) {
if (ReturningBlocks.empty()) {
ExitNode = 0;
- return false; // No blocks return
+ return false; // No blocks return
} else if (ReturningBlocks.size() == 1) {
ExitNode = ReturningBlocks.front(); // Already has a single return block
return false;