I've never seen a LoopPass, but doing a function pass and grab the loop info from "\llvm\Analysis\LoopInfo.h".<div><br></div><div>From there just you use the LoopInfo api to grap the loop headers and loop blocks and whatever else you want to do.</div>
<div><br></div><div>- Thank</div><div>Jeff Kunkel</div><br><div class="gmail_quote">On Thu, Jan 6, 2011 at 2:24 PM, Devang Patel <span dir="ltr"><<a href="mailto:dpatel@apple.com">dpatel@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div style="word-wrap:break-word"><br><div><div class="im"><div>On Jan 6, 2011, at 9:21 AM, Chuck Zhao wrote:</div><br>
<blockquote type="cite">
<div text="#000000" bgcolor="#ffffff">
LLVMers,<br>
<br>
I have a traversal plan which needs to visit certain types of
Functions. For each instruction in such functions, I will need to
know:<br>
1. is it located inside a loop<br>
2. if yes, what level of loop nest it is currently in.<br>
<br>
So on the highest level, it should be a FunctionPass. However, in
order to identify loops and loop-nest levels, it should also be a
LoopPass.<br>
<br>
Is there a reasonably simple way to identify loop(s) within a
function under FunctionPass?<br>
<br>
(Any existing LLVM code that I can take a look?)<br></div></blockquote><div><br></div></div><div>Your FunctionPass can use LoopInfo to get this information.</div><div><br></div><div>-</div><div>Devang</div><br><blockquote type="cite">
<div class="im"><div text="#000000" bgcolor="#ffffff">
<br>
<font color="#cc0000">OR</font><br>
<br>
Is it possible to intermix different types of LLVM Passes?<br>
<br>
E.g.<br>
<br>
class MyPass: public FunctionPass, public LoopPass{<br>
...<br>
public:<br>
bool runOnFunction(...);<br>
bool runOnLoop(...);<br>
...<br>
};<br>
<br>
Does this make any sense?<br>
I haven't seem to find any existing LLVM pass under such uses.<br>
<br>
<br>
Thank you very much<br>
<br>
Chuck<br>
<br>
</div></div>
_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br></blockquote></div><br></div><br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br>