[LLVMdev] Iterating on the DSGraph...

Chris Lattner sabre at nondot.org
Fri Nov 8 17:27:01 PST 2002


Oh, yeah, sorry, I forgot to answer your specific question:

> > What is the best way to implement a traversal of the DS graph, starting at
> > a scalar and processing all nodes to which the scalar allows access?

To get a DSNode for a value:
   DSGraph *G = ...;
   DSNode *N = G->getNodeForValue(V).getNode();

> > Currently the links vector is not public and there is no apparent way to
> > bound the getLink call (ie a getNumLinks call)....

Good point, there is now:
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20021104/001500.html

Note that it is only valid to pass an offset into getLink() that is
aligned to a pointer size boundary [ie a value returned by:
DSNode::getPointerSize()].  Although there is currently an easier way to
get the pointer size (rip it directly out of DS::PointerSize), that will
change in the future when I have time to clean it up, so don't count on
that interface.  :)

-Chris

-- 
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/




More information about the llvm-dev mailing list