Displaying 20 results from an estimated 24 matches for "df_iterator".
2009 Jun 15
3
[LLVMdev] Some df_iterator and po_iterator issues
Hi @llvm,
below is a copy of a message I sent to clang a hour before. I guess it's
more appropriate here.
--snip--
While trying to eleminate as much std::tr1::function as possible I
stumbled over a design flaw in llvm::df_iterator.
Consider the following code:
void for_all_stmts(Stmt* S, const std::tr1::function<void(Stmt*)>& fn)
{
if (S)
{
fn(S);
for (Stmt::child_iterator i = S->child_begin(), e = S->child_end();
i != e; ++i)
{
for_all_stmts(*i, fn);
}
}
}
In a first step I wan...
2002 Nov 08
1
[LLVMdev] Iterating on the DSGraph... (fwd)
...he DSGraph. And
I always got this error message. Couldn't figure out what's wrong. Could
you please let me know? Besides, I really have no idea about what those
functions do. Is there any documentation about DSGraph functions besides
the pool allocation paper?
Thanks,
xiaodong
Code:
for( df_iterator<DSNode*> I = df_begin(pnode), E=df_end(pnode); I!=E; ++
i) {
;
}
Error Message:
gmake
Compiling MemLeakage.cpp
../../../include/Support/DepthFirstIterator.h: In member function `void
df_iterator<GraphT, GT>::reverseEnterNode() [with GraphT = DSNode*, GT
=
GraphT...
2009 Jul 07
0
[LLVMdev] Some df_iterator and po_iterator issues
On Jun 15, 2009, at 4:33 AM, Olaf Krzikalla wrote:
> While trying to eleminate as much std::tr1::function as possible I
> stumbled over a design flaw in llvm::df_iterator.
Ok.
> However if fn replaces childrens of a just processed statement
> (which happens a lot), the iteration may crash. Looking at
> df_iterator reveals the reason: the first child of a particular
> statement is stored too early for this kind of usage. IMHO this
> could be...
2009 Jul 10
2
[LLVMdev] Some df_iterator and po_iterator issues
Chris,
attached you will find a patch implementing the approach I've posted
yesterday. I don't want the topic fall by the wayside*.
*Note that this patch here contains the df_iterator changes only, some
(IMHO non-critical but needed) po_iterator changes are still in the
pipeline and posted by me in another thread. I hope, the current
approach fits all needs.
Chris Lattner schrieb:
> This does sound like a useful use-case, but I am uncomfortable with
> making DepthFir...
2002 Nov 10
3
[LLVMdev] DSGraph questions
...ndle 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_i...
2002 Nov 11
1
[LLVMdev] DSGraph questions
...r 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...
2009 Jun 26
3
[LLVMdev] Patch for llvm::DepthFirstIterator.h and llvm::PostOrderIterator.h
...trieved in exactly that
moment it's needed. Until now it was retrieved too early, thus you
actually couldn't change the childs of a just processed node. I can't
think of an insane working example, which would break due to this change.
4. I added a public skipChilds member function to df_iterator which acts
similiar to operator++. However it skips all childs of the currently
processed node and returns *this. You can use it like in
for (i = df_begin(), e = df_end(); i!=e;)
{
foo() ? i.skipChilds() : ++i;
}
Best
Olaf Krzikalla
-------------- next part --------------
An embedded and char...
2002 Nov 10
0
[LLVMdev] DSGraph questions
...gt; 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*'...
2002 Nov 18
0
[LLVMdev] Fixed DSGraph iteration, depth first search, etc...
The following now works for me:
const DSNode *N1 = ...;
df_iterator<const DSNode*> X1 = df_begin(N1), XE1 = df_end(N1);
DSNode *N2 = ...;
df_iterator<DSNode*> X2 = df_begin(N2), XE2 = df_end(N2);
You need the following #includes:
#include "Support/DepthFirstIterator.h"
#include "llvm/Analysis/DSGraphTraits.h"
You need thi...
2009 Jun 27
0
[LLVMdev] Patch for llvm::DepthFirstIterator.h and llvm::PostOrderIterator.h
Hi Olaf,
This patch looks good to me. I just have a few minor comments:
> + inline df_iterator() { CurrentTopNode = 0; /* End is when stack
is empty */ }
Should the comment here be updated to say that the End
is reached when the stack is empty and when CurrentTopNode
is null?
> + inline void toNext()
> + {
LLVM style puts the open brace on the same line as the function name....
2009 Sep 06
2
[LLVMdev] Graphviz and LLVM-TV
...ataFlow.h deals with Value and User. Now BasicBlock is derived from
> Value and Instruction from User, but I don't understand how that helps.
>
> It's a bit confusing to be honest. Can you help?
>
Here are some examples on how to use the dataflow graphs:
Value *V = ...
for(df_iterator<Value*> UI = df_begin(V), UE = df_end(V); UI != UE; ++UI) {
...
}
typedef SmallPtrSet<const Value*, 16> SmallValueSet;
SmallValueSet DFSet;
const User* U = ...;
for (idf_ext_iterator<const User*, SmallValueSet> I=idf_ext_begin(U,
DFSet), E=idf_ext_end(U, DFSet); I != E; ++I) {
....
2009 Sep 06
0
[LLVMdev] Graphviz and LLVM-TV
...s derived from
>> Value and Instruction from User, but I don't understand how that helps.
>>
>> It's a bit confusing to be honest. Can you help?
>>
>>
>
> Here are some examples on how to use the dataflow graphs:
>
> Value *V = ...
> for(df_iterator<Value*> UI = df_begin(V), UE = df_end(V); UI != UE; ++UI) {
> ...
> }
>
>
> typedef SmallPtrSet<const Value*, 16> SmallValueSet;
> SmallValueSet DFSet;
> const User* U = ...;
> for (idf_ext_iterator<const User*, SmallValueSet> I=idf_ext_begin(U,
> DFSet)...
2009 Sep 06
3
[LLVMdev] Graphviz and LLVM-TV
...Instruction from User, but I don't understand how
>>> that helps.
>>>
>>> It's a bit confusing to be honest. Can you help?
>>>
>>
>> Here are some examples on how to use the dataflow graphs:
>>
>> Value *V = ...
>> for(df_iterator<Value*> UI = df_begin(V), UE = df_end(V); UI != UE;
>> ++UI) {
>> ...
>> }
>>
>>
>> typedef SmallPtrSet<const Value*, 16> SmallValueSet;
>> SmallValueSet DFSet;
>> const User* U = ...;
>> for (idf_ext_iterator<const User*, SmallVa...
2009 Apr 14
1
[LLVMdev] Depth First Sort of Machine Basic Blocks just before emitting code
Too obvious!
Thanks
Dan
On Apr 13, 2009, at 7:58 PM, John Mosby wrote:
> po_iterator (ADT/PostOrderIterator.h) ?
>
> On Mon, Apr 13, 2009 at 5:40 PM, Daniel M Gessel <gessel at apple.com>
> wrote:
> That looks like it does a preorder depth first traversal (I think).
> I'm looking for postorder. Is there a trivial transform between the
> two? (I don't know
2002 Nov 08
2
[LLVMdev] Re: LLVMdev digest, Vol 1 #44 - 2 msgs
llvm,
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)....
Dave
2002 Nov 08
0
[LLVMdev] Iterating on the DSGraph...
...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/
2009 Sep 06
0
[LLVMdev] Graphviz and LLVM-TV
I've tried to write a DFGPrinter based on the CFGPrinter, as you
suggested, but encountered problems.
The GraphWriter expects
GraphTraits<GraphType>::nodes_begin()/nodes_end(). The way this is
implemented in CFG.h, a function is a graph of basic blocks. A
GraphTraits<Function*> inherits from GraphTraits<BasicBlock*>, and
implements those nodes_begin()/nodes_end()
2009 Mar 12
4
[LLVMdev] Shrink Wrapping - RFC and initial implementation
...FG.
+ for (po_iterator<MachineBasicBlock*>
+ MBBI = po_begin(Fn.getBlockNumbered(0)),
+ MBBE = po_end(Fn.getBlockNumbered(0)); MBBI != MBBE; ++MBBI) {
+ MachineBasicBlock* MBB = *MBBI;
...
+ // Calculate Avail{In,Out} via top-down walk of Machine dominator
tree.
+ for (df_iterator<MachineDomTreeNode*> DI = df_begin(DT.getRootNode
()),
+ E = df_end(DT.getRootNode()); DI != E; ++DI) {
Later in
+/// placeSpillsAndRestores - decide which MBBs need spills, restores
+/// of CSRs.
+///
+void PEI::placeSpillsAndRestores(MachineFunction &Fn) {
...
+ // Calcula...
2009 Aug 13
1
[LLVMdev] Graphviz and LLVM-TV
Hi Ioannis,
On Thu, 2009-08-13 at 19:31 +0100, Ioannis Nousias wrote:
> Thanks Tobi for the tip.
>
> however I also need the Data-Flow-Graph of each basic block/functions.
> As I said, I need a view of how the instructions 'link' to each other
> (via registers or memory aliasing or whatnot)
I believe that there is not yet a DOT printer for this kind of
information.
2009 Sep 07
0
[LLVMdev] Graphviz and LLVM-TV
...how
>>>> that helps.
>>>>
>>>> It's a bit confusing to be honest. Can you help?
>>>>
>>>>
>>> Here are some examples on how to use the dataflow graphs:
>>>
>>> Value *V = ...
>>> for(df_iterator<Value*> UI = df_begin(V), UE = df_end(V); UI != UE;
>>> ++UI) {
>>> ...
>>> }
>>>
>>>
>>> typedef SmallPtrSet<const Value*, 16> SmallValueSet;
>>> SmallValueSet DFSet;
>>> const User* U = ...;
>>> for (idf_...