| 52 | |
| 53 | template<class FunctionSetT> |
| 54 | void descendCallGraphAndAdd(llvm::Function* F, llvm::CallGraph& CG, FunctionSetT& Set){ |
| 55 | if(!F || Set.contains(F)) |
| 56 | return; |
| 57 | |
| 58 | Set.insert(F); |
| 59 | llvm::CallGraphNode* CGN = CG.getOrInsertFunction(F); |
| 60 | if(!CGN) |
| 61 | return; |
| 62 | for(unsigned i = 0; i < CGN->size(); ++i){ |
| 63 | descendCallGraphAndAdd((*CGN)[i]->getFunction(), CG, Set); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | // Check whether F is used by an instruction from any function contained in |
| 68 | // a set S |