void TDDataStructures::markReachableFunctionsExternallyAccessible(DSNode *N, hash_set<DSNode*> &Visited) { if (!N || Visited.count(N)) return; Visited.insert(N); for (unsigned i = 0, e = N->getNumLinks(); i != e; ++i) { DSNodeHandle &NH = N->getLink(i); if (DSNode *NN = NH.getNode()) { std::vector<const Function*> Functions; NN->addFullFunctionList(Functions); ArgsRemainIncomplete.insert(Functions.begin(), Functions.end()); markReachableFunctionsExternallyAccessible(NN, Visited); } } }
void TDDataStructures::ComputePostOrder(const Function* F, hash_set<DSGraph*> &Visited, std::vector<DSGraph*> &PostOrder) { if (F->isDeclaration()) return; DSGraph* G = getOrFetchDSGraph(F); if (Visited.count(G)) return; Visited.insert(G); // Recursively traverse all of the callee graphs. for (DSGraph::fc_iterator CI = G->fc_begin(), CE = G->fc_end(); CI != CE; ++CI){ Instruction *CallI = CI->getCallSite().getInstruction(); for (calleeTy::iterator I = callee.begin(CallI), E = callee.end(CallI); I != E; ++I) ComputePostOrder(*I, Visited, PostOrder); } PostOrder.push_back(G); }