mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-21 08:17:40 +00:00
[LCG] Add some basic methods for querying the parent/child relationships
of SCCs in the SCC DAG. Exercise them in the big graph test case. These will be especially useful for establishing invariants in insertion logic. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207749 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -162,6 +162,21 @@ void LazyCallGraph::SCC::insert(Node &N) {
|
||||
G->SCCMap[&N] = this;
|
||||
}
|
||||
|
||||
bool LazyCallGraph::SCC::isDescendantOf(const SCC &C) const {
|
||||
// Walk up the parents of this SCC and verify that we eventually find C.
|
||||
SmallVector<const SCC *, 4> AncestorWorklist;
|
||||
AncestorWorklist.push_back(this);
|
||||
do {
|
||||
const SCC *AncestorC = AncestorWorklist.pop_back_val();
|
||||
if (AncestorC->isChildOf(C))
|
||||
return true;
|
||||
for (const SCC *ParentC : AncestorC->ParentSCCs)
|
||||
AncestorWorklist.push_back(ParentC);
|
||||
} while (!AncestorWorklist.empty());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void LazyCallGraph::SCC::insertIntraSCCEdge(Node &CallerN, Node &CalleeN) {
|
||||
// First insert it into the caller.
|
||||
CallerN.insertEdgeInternal(CalleeN);
|
||||
|
||||
Reference in New Issue
Block a user