[LLVMdev] DSGraph questions
Vikram Adve
vadve at cs.uiuc.edu
Sun Nov 10 12:09:01 PST 2002
I'll try to answer these because Chris is really busy this week.
> From: Xiaodong Li <xli3 at santoor.cs.uiuc.edu>
> Subject: [LLVMdev] DSGraph questions
> Sender: llvmdev-admin at cs.uiuc.edu
> Date: Sun, 10 Nov 2002 11:25:53 -0600 (CST)
>
> 1. What is the difference between DSNodeHandle and DSNode? What do the
> functions getLink() and getSize() do?
DSNodeHandle is essentially like an edge in the DSGraph.
It serves two main purposes:
(1) It keeps track of which byte offset is being pointed to within
the target node.
(2) It keeps track of how many objects have pointers to a DSNode,
so that it can check if the number is zero and free a node
(reference counting)
getLink(Offset) returns the outgoing edge at byte offset "Offset"
from the current node. (think of each node as a struct, so there
can be pointers at different byte offsets within the struct.)
getSize() returns the max #bytes for any object folded into this node.
> 2. In the previous email, you mentioned that we can use
> DSNode::getPointerSize() to get the number of links, But I checked the
> doxygen documentation, there is no such member for DSNode.
Check the header file. The doxygen docs were a little out of date
(but Chris has updated them now).
> 3. Previously I use the following code:
> for( df_iterator<DSNode*> I = df_begin(pnode), E=df_end(pnode); I!=E; ++i)
> {
> ... ;
> }
> and got lots of error messages when I compile. And the reply was:
> >What is the type of pnode? Guessing from the error message, I would think
> >it's a 'const DSNode*'. You need to use either df_iterator<const DSNode*>
> >or a DSNode* argument, you can't mix them.
>
> I checked and found out that I was using
> DSNode *pnode = dsg->getNodeforValue(fi).getNode() to get pnode.
> So I think it's a DSNode.
I would have to see the error messages. In generally, if you have any
const variables or functions, you will get lots of error messages unless
you use them very carefully.
--Vikram
http://www.cs.uiuc.edu/~vadve
More information about the llvm-dev
mailing list