summaryrefslogtreecommitdiff
path: root/include/llvm/Analysis/CallGraph.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-08-31 07:23:46 +0000
committerChris Lattner <sabre@nondot.org>2009-08-31 07:23:46 +0000
commitbe577659d3c1222cc58c33628c0baddb94d241ab (patch)
tree368cb0f8a6d7b34fe9c676debf76b63df465d5ef /include/llvm/Analysis/CallGraph.h
parentb0b822c44935f9381b4b32baa6324d445067f98a (diff)
downloadllvm-be577659d3c1222cc58c33628c0baddb94d241ab.tar.gz
llvm-be577659d3c1222cc58c33628c0baddb94d241ab.tar.bz2
llvm-be577659d3c1222cc58c33628c0baddb94d241ab.tar.xz
Step #1 to giving Callgraph some sane invariants. The problems with callgraph
stem from the fact that we have two types of passes that need to update it: 1. callgraphscc and module passes that are explicitly aware of it 2. Functionpasses (and loop passes etc) that are interlaced with CGSCC passes by the CGSCC Passmgr. In the case of #1, we can reasonably expect the passes to update the call graph just like any analysis. However, functionpasses are not and generally should not be CG aware. This has caused us no end of problems, so this takes a new approach. Logically, the CGSCC Pass manager can rescan every function after it runs a function pass over it to see if the functionpass made any updates to the IR that affect the callgraph. This allows it to catch new calls introduced by the functionpass. In practice, doing this would be slow. This implementation keeps track of whether or not the current scc is dirtied by a function pass, and, if so, delays updating the callgraph until it is actually needed again. This was we avoid extraneous rescans, but we still have good invariants when the callgraph is needed. Step #2 of the "give Callgraph some sane invariants" is to change CallGraphNode to use a CallBackVH for the callsite entry of the CallGraphNode. This way we can immediately remove entries from the callgraph when a FunctionPass is active instead of having dangling pointers. The current pass tries to tolerate these dangling pointers, but it is just an evil hack. This is related to PR3601/4835/4029. This also reverts r80541, a hack working around the sad lack of invariants. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80566 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis/CallGraph.h')
-rw-r--r--include/llvm/Analysis/CallGraph.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/llvm/Analysis/CallGraph.h b/include/llvm/Analysis/CallGraph.h
index bc022e3417..0e997cab7f 100644
--- a/include/llvm/Analysis/CallGraph.h
+++ b/include/llvm/Analysis/CallGraph.h
@@ -107,6 +107,7 @@ public:
/// Returns the CallGraphNode which is used to represent undetermined calls
/// into the callgraph. Override this if you want behavioral inheritance.
virtual CallGraphNode* getExternalCallingNode() const { return 0; }
+ virtual CallGraphNode* getCallsExternalNode() const { return 0; }
/// Return the root/main method in the module, or some other root node, such
/// as the externalcallingnode. Overload these if you behavioral
@@ -248,6 +249,10 @@ public:
/// should be used sparingly.
void removeCallEdgeFor(CallSite CS);
+ // FIXME: REMOVE THIS WHEN HACK IS REMOVED FROM CGSCCPASSMGR.
+ void removeCallEdgeFor(Instruction *CS);
+
+
/// removeAnyCallEdgeTo - This method removes all call edges from this node
/// to the specified callee function. This takes more time to execute than
/// removeCallEdgeTo, so it should not be used unless necessary.