<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jan 6, 2011, at 9:21 AM, Chuck Zhao wrote:</div><br class="Apple-interchange-newline"><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>Your FunctionPass can use LoopInfo to get this information.</div><div><br></div><div>-</div><div>Devang</div><br><blockquote type="cite"><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>
_______________________________________________<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">http://llvm.cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br></blockquote></div><br></body></html>