[LLVMdev] Find mallocs from a DSNode

Chris Lattner sabre at nondot.org
Sun Nov 10 22:36:01 PST 2002


> Is there some efficient way to find the malloc instructions which point
> to the memory represented by a DSNode?  Right now the only way I see is
> by iterating through the value map in the DSGraph object and finding
> every value that points to my DSNode.

You're right, you have to iterate over the program, looking to see what
DSNodes the Malloc instructions point to.  This is intentional: keeping
track of this information would cause a huge representational problem.
Sorry :)

> A possibly related question: is there a way to tell that the node has
> been merged, and if so, what types of nodes went into the merge?

Yup, DSNode::NodeType contains flags for the node.  There are four flags
that indicate the composition of the node: DSNode::AllocaNode, HeapNode,
GlobalNode, UnknownNode.

When two nodes are merged, their Flags are bitwise or'd together...

-Chris

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




More information about the llvm-dev mailing list