Displaying 14 results from an estimated 14 matches for "hasloop".
2010 Nov 01
2
[LLVMdev] Identify recursion in a call graph
...rsive() {
CallGraphNode* rootNode = getAnalysis<CallGraph>().getRoot();
for (scc_iterator<CallGraphNode*> SCCI = scc_begin(rootNode), E =
scc_end(rootNode); SCCI != E; ++SCCI) {
const std::vector<CallGraphNode*> &nextSCC = *SCCI;
if (nextSCC.size() == 1 && SCCI.hasLoop()) {
return true;
}
}
return false;
}
This correctly identifies direct (self) recursion but fails to
identify indirect recursion, such as:
void foo() { bar(); }
void bar() { foo(); }
Any suggestions on how to identify both types? Thanks,
Trevor
P.S. Is it possible to start the call gr...
2010 Nov 02
0
[LLVMdev] Identify recursion in a call graph
...llGraphNode* rootNode = getAnalysis<CallGraph>().getRoot();
> for (scc_iterator<CallGraphNode*> SCCI = scc_begin(rootNode), E =
> scc_end(rootNode); SCCI != E; ++SCCI) {
> const std::vector<CallGraphNode*> &nextSCC = *SCCI;
> if (nextSCC.size() == 1 && SCCI.hasLoop()) {
> return true;
> }
> }
> return false;
> }
>
> This correctly identifies direct (self) recursion but fails to identify indirect
> recursion, such as:
>
> void foo() { bar(); }
> void bar() { foo(); }
>
> Any suggestions on how to identify both types? Than...
2009 Aug 04
2
[LLVMdev] [PATCH] Add functionality to scc_iterator
...erator<T*> cur = scc_begin(bb);
+ while(cur!=scc_end(bb))
+ {
+ for(typename std::vector<typename
GraphTraits<T*>::NodeType*>::iterator i = (*cur).begin();
i!=(*cur).end(); i++)
+ if(*i==bb)
+ return cur.hasLoop();
+ cur++;
+ }
+
+ //We should never get here.
+ abort();
+}
+
} // End llvm namespace
#endif
2010 Nov 05
3
[LLVMdev] Identify recursion in a call graph
On Nov 2, 2010, at 11:08 PM, Nick Lewycky wrote:
> The unittests/ directory contains C++ unit tests for arbitrary C++
> APIs
> that don't fit the dejagnu model of running opt or llc over .ll files.
Thanks for the tip. Attached is a patch+testcase that adds
CallGraphNode::isRecursive to LLVM. Could someone with commit access
please review and apply? Thanks,
Trevor
2010 Nov 02
2
[LLVMdev] Identify recursion in a call graph
...e = getAnalysis<CallGraph>().getRoot();
> > for (scc_iterator<CallGraphNode*> SCCI = scc_begin(rootNode), E =
> > scc_end(rootNode); SCCI != E; ++SCCI) {
> > const std::vector<CallGraphNode*> &nextSCC = *SCCI;
> > if (nextSCC.size() == 1 && SCCI.hasLoop()) {
> > return true;
> > }
> > }
> > return false;
> > }
> >
> > This correctly identifies direct (self) recursion but fails to identify
> indirect
> > recursion, such as:
> >
> > void foo() { bar(); }
> > void bar() { foo(); }
&...
2009 Aug 07
2
[LLVMdev] [PATCH] Add functionality to scc_iterator
...ator<T*> cur = scc_begin(bb);
+ while(cur!=scc_end(bb))
+ {
+ for(typename std::vector<typename
GraphTraits<T*>::NodeType*>::iterator i = (*cur).begin();
i!=(*cur).end(); i++)
+ if(*i==bb)
+ return cur.hasLoop();
+ cur++;
+ }
+
+ //We should never get here.
+ abort();
+}
+
} // End llvm namespace
#endif
Index: include/llvm/ADT/GraphTraits.h
===================================================================
--- include/llvm/ADT/GraphTraits.h (revision 76093)
+++ in...
2009 Aug 04
0
[LLVMdev] [PATCH] Add functionality to scc_iterator
..._iterator<T*> cur = scc_begin(bb);
+ while(cur!=scc_end(bb))
+ {
+ for(typename vector<typename
GraphTraits<T*>::NodeType*>::iterator i = (*cur).begin();
i!=(*cur).end(); i++)
+ if(*i==bb)
+ return cur.hasLoop();
+ cur++;
+ }
+
+ //We should never get here.
+ abort();
+}
+
} // End llvm namespace
#endif
2010 Oct 29
2
[LLVMdev] Identify recursion in a call graph
Hi,
Is there any facility in LLVM to identify recursion in a call graph? I
realize this is undecidable in the general case due to function
pointers, but at least the static cases could be identified. I don't
even care about whole-program recursion, just looking at a single
module would suffice. But I don't see anything like this already in
LLVM, so do I simply write some code to
2010 Oct 30
0
[LLVMdev] Identify recursion in a call graph
Hi Trevor,
> Is there any facility in LLVM to identify recursion in a call graph? I
> realize this is undecidable in the general case due to function
> pointers, but at least the static cases could be identified. I don't
> even care about whole-program recursion, just looking at a single
> module would suffice. But I don't see anything like this already in
> LLVM, so do
2009 Aug 06
0
[LLVMdev] [PATCH] Add functionality to scc_iterator
...);
> + while(cur!=scc_end(bb))
> + {
> + for(typename std::vector<typename
> GraphTraits<T*>::NodeType*>::iterator i = (*cur).begin();
> i!=(*cur).end(); i++)
> + if(*i==bb)
> + return cur.hasLoop();
> + cur++;
> + }
> +
> + //We should never get here.
> + abort();
> +}
> +
> } // End llvm namespace
>
> #endif
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.e...
2010 Nov 02
0
[LLVMdev] Identify recursion in a call graph
...lt;CallGraph>().getRoot();
>> > for (scc_iterator<CallGraphNode*> SCCI = scc_begin(rootNode), E =
>> > scc_end(rootNode); SCCI != E; ++SCCI) {
>> > const std::vector<CallGraphNode*> &nextSCC = *SCCI;
>> > if (nextSCC.size() == 1 && SCCI.hasLoop()) {
>> > return true;
>> > }
>> > }
>> > return false;
>> > }
>> >
>> > This correctly identifies direct (self) recursion but fails to identify
>> indirect
>> > recursion, such as:
>> >
>> > void foo()...
2009 Aug 07
0
[LLVMdev] [PATCH] Add functionality to scc_iterator
On Aug 6, 2009, at 4:19 PM, Patrick Alexander Simmons wrote:
> Chris Lattner wrote:
>> On Aug 4, 2009, at 3:48 PM, Patrick Alexander Simmons wrote:
>>
>>
>>> Hi,
>>>
>>> I've been using scc_iterator, and I added the templates necessary to
>>> make it work with inverse graphs. I also added a "bb_reachable"
>>>
2009 Aug 07
0
[LLVMdev] [PATCH] Add functionality to scc_iterator
...);
> + while(cur!=scc_end(bb))
> + {
> + for(typename std::vector<typename
> GraphTraits<T*>::NodeType*>::iterator i = (*cur).begin();
> i!=(*cur).end(); i++)
> + if(*i==bb)
> + return cur.hasLoop();
> + cur++;
> + }
> +
> + //We should never get here.
> + abort();
> +}
> +
> } // End llvm namespace
>
> #endif
> Index: include/llvm/ADT/GraphTraits.h
> ===================================================================
> -...
2009 Aug 06
2
[LLVMdev] [PATCH] Add functionality to scc_iterator
Chris Lattner wrote:
> On Aug 4, 2009, at 3:48 PM, Patrick Alexander Simmons wrote:
>
>
>> Hi,
>>
>> I've been using scc_iterator, and I added the templates necessary to
>> make it work with inverse graphs. I also added a "bb_reachable"
>> function to tell whether an arbitrary graph node is part of cycle.
>> Might this be useful to