- Do not expose ::ID from any of the analyses anymore.
[oota-llvm.git] / include / llvm / Transforms / Utils / UnifyFunctionExitNodes.h
1 //===-- UnifyFunctionExitNodes.h - Ensure fn's have one return ---*- C++ -*--=//
2 //
3 // This pass is used to ensure that functions have at most one return
4 // instruction in them.  Additionally, it keeps track of which node is the new
5 // exit node of the CFG.  If there are no exit nodes in the CFG, the getExitNode
6 // method will return a null pointer.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLVM_XFORMS_UNIFY_FUNCTION_EXIT_NODES_H
11 #define LLVM_XFORMS_UNIFY_FUNCTION_EXIT_NODES_H
12
13 #include "llvm/Pass.h"
14
15 struct UnifyFunctionExitNodes : public FunctionPass {
16   BasicBlock *ExitNode;
17 public:
18   UnifyFunctionExitNodes() : ExitNode(0) {}
19
20   // getExitNode - Return the new single (or nonexistant) exit node of the CFG.
21   //
22   BasicBlock *getExitNode() const { return ExitNode; }
23
24   virtual bool runOnFunction(Function &F);
25 };
26
27 static inline Pass *createUnifyFunctionExitNodesPass() {
28   return new UnifyFunctionExitNodes();
29 }
30
31 #endif