[PATCH] D42311: [SyntheticCounts] Rewrite the code using only graph traits.
Easwaran Raman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 22 11:38:01 PST 2018
eraman added inline comments.
================
Comment at: include/llvm/Analysis/CallGraph.h:541
+
+ static CallEdgeIteratorType call_edge_begin(NodeRef N) { return N->begin(); }
+ static CallEdgeIteratorType call_edge_end(NodeRef N) { return N->end(); }
----------------
davidxl wrote:
> use 'child_begin()/child_end()'?
child_begin/end is used in CallGraphTraits to iterate over children nodes.
================
Comment at: include/llvm/Analysis/CallGraph.h:546
+
+ static bool has_function_def(NodeRef N) {
+ return N->getFunction() != nullptr && !N->getFunction()->isDeclaration();
----------------
davidxl wrote:
> Is it better to push this method into the base class ( template<> GraphTraits<Callgraph*> )?
This is not really a graph trait and obviously doesn't make sense for other graphs. So an algorithm that works on a general graph which is specialized for GraphTraits cannot do GraphTraits<G>::has_function_def and so this logically belongs here.
Repository:
rL LLVM
https://reviews.llvm.org/D42311
More information about the llvm-commits
mailing list