> I use the following code to do the depth first search on the DSGraph. And
> I always got this error message. Couldn't figure out what's wrong.
Could
> you please let me know?
> for( df_iterator<DSNode*> I = df_begin(pnode), E=df_end(pnode); I!=E;
++i) {
> ;
> }
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.
> Besides, I really have no idea about what those
> functions do. Is there any documentation about DSGraph functions besides
> the pool allocation paper?
No, I'm working on it.
-Chris
> Code:
>
> Error Message:
> gmake
> Compiling MemLeakage.cpp
> ../../../include/Support/DepthFirstIterator.h: In member function `void
> df_iterator<GraphT, GT>::reverseEnterNode() [with GraphT =
DSNode*, GT
> > GraphTraits<DSNode*>]':
> ../../../include/Support/DepthFirstIterator.h:49: instantiated from
> `df_iterator<GraphT, GT>::df_iterator(GT::NodeType*, bool) [with
GraphT > DSNode*, GT = GraphTraits<DSNode*>]'
> ../../../include/Support/DepthFirstIterator.h:58: instantiated from
> `static df_iterator<GraphT, GT> df_iterator<GraphT,
GT>::begin(GraphT,
> bool) [with GraphT = DSNode*, GT = GraphTraits<DSNode*>]'
> ../../../include/Support/DepthFirstIterator.h:125: instantiated from
> `df_iterator<T, GraphTraits<GraphT> > df_begin(T, bool) [with T
> DSNode*]'
> MemLeakage.cpp:114: instantiated from here
> ../../../include/Support/DepthFirstIterator.h:36: invalid conversion from
> `
> const DSNode*' to `DSNode*'
> gmake: *** [Debug/MemLeakage.o] Error 1
>
>
>
> On Fri, 8 Nov 2002, Vikram Adve wrote:
>
> > Are any of you not on the llvmdev mailing list? If so, can you please
> > subscribe to that list so I can stop forwarding these messages.
> > (If I don't hear from anyone, I'll assume you all are.)
> >
> > For now, here's a useful message about traversing DSGraphs.
> > Let me add one more tip:
> >
> > To get the node pointed to be a scalar pointer, you simply say:
> >
> > Value* ptr = ... // the scalar pointer
> > DSNodeHandle& ptrNode = funcGraph.getNodeForValue(ptr);
> > DSNode* target = ptrNode.getNode(); // cannot be NULL
> >
> >
> > (Chris, am I right that a scalar pointer always points to some
> > graph node?)
> >
> > --Vikram
> >
> >
> > From llvmdev-admin at cs.uiuc.edu Fri Nov 8 17:18 CST 2002
> > Received: from dcs-server1.cs.uiuc.edu
(dcs-research1-server1.cs.uiuc.edu [128.174.244.4])
> > by tank.cs.uiuc.edu (8.9.3/8.9.3) with ESMTP id RAA02614;
> > Fri, 8 Nov 2002 17:18:04 -0600 (CST)
> > Received: from dcs-server2.cs.uiuc.edu (dcs-server2.cs.uiuc.edu
[128.174.252.3])
> > by dcs-server1.cs.uiuc.edu (8.9.3/8.9.3) with ESMTP id RAA17491;
> > Fri, 8 Nov 2002 17:18:04 -0600 (CST)
> > Received: from dcs-server2.cs.uiuc.edu (localhost [127.0.0.1])
> > by dcs-server2.cs.uiuc.edu (8.12.5/8.12.5) with ESMTP id
gA8NI2lZ026121;
> > Fri, 8 Nov 2002 17:18:02 -0600 (CST)
> > Received: from dcs-server1.cs.uiuc.edu (dcs-server1.cs.uiuc.edu
[128.174.252.1])
> > by dcs-server2.cs.uiuc.edu (8.12.5/8.12.5) with ESMTP id
gA8NHdlZ026097
> > for <llvmdev at dcs-server2.cs.uiuc.edu>; Fri, 8 Nov 2002
17:17:39 -0600 (CST)
> > Received: from nondot.org (nondot.cs.uiuc.edu [128.174.245.159])
> > by dcs-server1.cs.uiuc.edu (8.9.3/8.9.3) with ESMTP id RAA17467
> > for <llvmdev at cs.uiuc.edu>; Fri, 8 Nov 2002 17:17:39 -0600
(CST)
> > Received: by nondot.org (Postfix, from userid 501)
> > id 5523617C1CE; Fri, 8 Nov 2002 18:25:04 -0500 (EST)
> > Received: from localhost (localhost [127.0.0.1])
> > by nondot.org (Postfix) with ESMTP
> > id 488FD24D019; Fri, 8 Nov 2002 17:25:04 -0600 (CST)
> > From: Chris Lattner <sabre at nondot.org>
> > To: David Crowe <dcrowe at tremor.crhc.uiuc.edu>
> > Cc: llvmdev at cs.uiuc.edu
> > In-Reply-To: <Pine.LNX.4.33.0211081707090.11485-100000 at
tremor.crhc.uiuc.edu>
> > Message-ID: <Pine.LNX.4.44.0211081721560.18180-100000 at
nondot.org>
> > MIME-Version: 1.0
> > Subject: [LLVMdev] Iterating on the DSGraph...
> > Sender: llvmdev-admin at cs.uiuc.edu
> > Errors-To: llvmdev-admin at cs.uiuc.edu
> > X-BeenThere: llvmdev at cs.uiuc.edu
> > X-Mailman-Version: 2.0.12
> > Precedence: bulk
> > List-Unsubscribe:
<http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev>,
> > <mailto:llvmdev-request at cs.uiuc.edu?subject=unsubscribe>
> > List-Id: LLVM Developers Mailing List <llvmdev.cs.uiuc.edu>
> > List-Post: <mailto:llvmdev at cs.uiuc.edu>
> > List-Help: <mailto:llvmdev-request at cs.uiuc.edu?subject=help>
> > List-Subscribe:
<http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev>,
> > <mailto:llvmdev-request at cs.uiuc.edu?subject=subscribe>
> > List-Archive: <http://mail.cs.uiuc.edu/pipermail/llvmdev/>
> > X-Original-Date: Fri, 8 Nov 2002 17:25:04 -0600 (CST)
> > Date: Fri, 8 Nov 2002 17:25:04 -0600 (CST)
> > Content-Type: TEXT/PLAIN; charset=US-ASCII
> > Content-Length: 1073
> >
> >
> > > 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?
> > > Currently the links vector is not public and there is no apparent
way to
> > > bound the getLink call (ie a getNumLinks call)....
> >
> > Warning, untested code follows, but you should get the idea:
> >
> >
> > #include "llvm/Analysis/DSGraphTraits.h"
> >
> > DSNode *N = ...
> >
> > // Visit all children of a node...
> > for (DSNode::iterator I = N->begin(), E = N->end(); I != E;
++I)
> > if (I->getNode())
> > visit(I->getNode(), I->getOffset());
> >
> > // Depth first traversal from a node:
> > #include "Support/DepthFirstIterator.h"
> >
> > for (df_iterator<DSNode*> I = df_begin(N), E = df_end(); I !=
E; ++I)
> > visit(*I);
> >
> > Note that this hasn't been tested recently, but it should
basically
> > work.
> >
> > -Chris
> >
> > --
> > http://llvm.cs.uiuc.edu/
> > http://www.nondot.org/~sabre/Projects/
> >
> > _______________________________________________
> > LLVM Developers mailing list
> > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> > http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev
> >
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev
>
-Chris
--
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/