1. What is the difference between DSNodeHandle and DSNode? What do the functions getLink() and getSize() do? 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. 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. Would you please answer these questions? Thanks, Jerry
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
On Sun, 10 Nov 2002, Xiaodong Li wrote:> 3. Previously I use the following code: > for( df_iterator<DSNode*> I = df_begin(pnode), E=df_end(pnode); I!=E; ++i)Note that you instantiate `I' but increment `i'. -- Misha Brukman :: uiuc.edu/~brukman
Dear Prof. Adve, I recently checked out the llvm using cvs update command under the llvm directory. But when I went to see the DSNode.h, there is no getPointerSize function. I checked the doxygen tree, it's there. So that means I didn't update my cvs tree correctly. Could you let me know how to update my CVS tree? Or there is a problem at somewhere else? Thanks, xiaodong On Sun, 10 Nov 2002, Vikram Adve wrote:> 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 >