diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2014-04-30 10:48:36 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2014-04-30 10:48:36 +0000 |
commit | 491f476b8bf5d2b201733c27a079a9a7015ffc44 (patch) | |
tree | 98b2ad761bee8b18c106f7a9c2984e3fac56b0f3 /lib | |
parent | 0a780977749191616c2ceac32acca441ab519e07 (diff) | |
download | llvm-491f476b8bf5d2b201733c27a079a9a7015ffc44.tar.gz llvm-491f476b8bf5d2b201733c27a079a9a7015ffc44.tar.bz2 llvm-491f476b8bf5d2b201733c27a079a9a7015ffc44.tar.xz |
[LCG] Add the really, *really* boring edge insertion case: adding an
edge entirely within an existing SCC. Shockingly, making the connected
component more connected is ... a total snooze fest. =]
Anyways, its wired up, and I even added a test case to make sure it
pretty much sorta works. =D
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207631 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Analysis/LazyCallGraph.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/lib/Analysis/LazyCallGraph.cpp b/lib/Analysis/LazyCallGraph.cpp index dd940a98f3..6c4574f867 100644 --- a/lib/Analysis/LazyCallGraph.cpp +++ b/lib/Analysis/LazyCallGraph.cpp @@ -76,11 +76,16 @@ LazyCallGraph::Node::Node(LazyCallGraph &G, Function &F) } void LazyCallGraph::Node::insertEdgeInternal(Function &Callee) { - CalleeIndexMap.insert(std::make_pair(&Callee, Callees.size())); if (Node *N = G->lookup(Callee)) - Callees.push_back(N); - else - Callees.push_back(&Callee); + return insertEdgeInternal(*N); + + CalleeIndexMap.insert(std::make_pair(&Callee, Callees.size())); + Callees.push_back(&Callee); +} + +void LazyCallGraph::Node::insertEdgeInternal(Node &CalleeN) { + CalleeIndexMap.insert(std::make_pair(&CalleeN.getFunction(), Callees.size())); + Callees.push_back(&CalleeN); } void LazyCallGraph::Node::removeEdgeInternal(Function &Callee) { @@ -157,6 +162,16 @@ void LazyCallGraph::SCC::insert(Node &N) { G->SCCMap[&N] = this; } +void LazyCallGraph::SCC::insertIntraSCCEdge(Node &CallerN, Node &CalleeN) { + // First insert it into the caller. + CallerN.insertEdgeInternal(CalleeN); + + assert(G->SCCMap.lookup(&CallerN) == this && "Caller must be in this SCC."); + assert(G->SCCMap.lookup(&CalleeN) == this && "Callee must be in this SCC."); + + // Nothing changes about this SCC or any other. +} + void LazyCallGraph::SCC::removeInterSCCEdge(Node &CallerN, Node &CalleeN) { // First remove it from the node. CallerN.removeEdgeInternal(CalleeN.getFunction()); |