[PATCH] D42311: [SyntheticCounts] Rewrite the code using only graph traits.
David Li via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 22 11:48:58 PST 2018
davidxl 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(); }
----------------
eraman wrote:
> davidxl wrote:
> > use 'child_begin()/child_end()'?
> child_begin/end is used in CallGraphTraits to iterate over children nodes.
ok. Does it make sense to push edge_begin method to the subclass instead?
================
Comment at: include/llvm/Analysis/CallGraph.h:546
+
+ static bool has_function_def(NodeRef N) {
+ return N->getFunction() != nullptr && !N->getFunction()->isDeclaration();
----------------
eraman wrote:
> 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.
ok. Makes sense
Repository:
rL LLVM
https://reviews.llvm.org/D42311
More information about the llvm-commits
mailing list