summaryrefslogtreecommitdiff
path: root/include/llvm/Transforms/Utils
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-01-30 23:29:35 +0000
committerChris Lattner <sabre@nondot.org>2002-01-30 23:29:35 +0000
commit967a04442d92f224911eb65b4c06102048f318c2 (patch)
treea4cbe8ad2490fd3bf9ad319a14e14db94e753482 /include/llvm/Transforms/Utils
parentfacd752d3afaeca7dee46648f2a2ae209a94e5e9 (diff)
downloadllvm-967a04442d92f224911eb65b4c06102048f318c2.tar.gz
llvm-967a04442d92f224911eb65b4c06102048f318c2.tar.bz2
llvm-967a04442d92f224911eb65b4c06102048f318c2.tar.xz
Convert xforms over to use new pass structure
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1596 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Transforms/Utils')
-rw-r--r--include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h b/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h
new file mode 100644
index 0000000000..09394685c1
--- /dev/null
+++ b/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h
@@ -0,0 +1,37 @@
+//===-- UnifyMethodExitNodes.h - Ensure methods have one return --*- C++ -*--=//
+//
+// This pass is used to ensure that methods have at most one return instruction
+// in them. It also holds onto the return instruction of the last unified
+// method.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_XFORMS_UNIFY_METHOD_EXIT_NODES_H
+#define LLVM_XFORMS_UNIFY_METHOD_EXIT_NODES_H
+
+#include "llvm/Pass.h"
+#include "llvm/Analysis/SimplifyCFG.h" // FIXME!!
+
+struct UnifyMethodExitNodes : public MethodPass {
+ BasicBlock *ExitNode;
+public:
+ static AnalysisID ID; // Pass ID
+ UnifyMethodExitNodes(AnalysisID id) : ExitNode(0) { assert(ID == id); }
+
+ virtual bool runOnMethod(Method *M) {
+ ExitNode = cfg::UnifyAllExitNodes(M);
+
+ return true; // FIXME: This should return a correct code!!!
+ }
+
+ BasicBlock *getExitNode() const { return ExitNode; }
+
+ virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Required,
+ Pass::AnalysisSet &Destroyed,
+ Pass::AnalysisSet &Provided) {
+ // FIXME: Should invalidate CFG
+ Provided.push_back(ID); // Provide self!
+ }
+};
+
+#endif