blob: 09394685c1e86bcd4573427b4dceb7f62330568e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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
|