Actually it didnt require the getAnalysisUsage in the loop pass. I was just able to call the getAnalysis in my runOnLoop. That solved my problem.<br><br>Thanks guys.<br><br><div class="gmail_quote">On Mon, Feb 28, 2011 at 6:42 PM, Justin Holewinski <span dir="ltr"><<a href="mailto:justin.holewinski@gmail.com">justin.holewinski@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="gmail_quote"><div class="im">On Mon, Feb 28, 2011 at 6:04 PM, Naznin Fauzia <span dir="ltr"><<a href="mailto:laboni14@gmail.com" target="_blank">laboni14@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Thanks Devang and John. My pass is actually a loop pass, not a function pass. So, I couldnt override the <font face="Courier">getAnalysisUsage.<br></font></blockquote><div><br></div></div><div>A LoopPass is no different from a FunctionPass here. You can use getAnalysisUsage and getAnalysis in a LoopPass.</div>
<div> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div></div><div class="h5"><font face="Courier"><font style="font-family: arial,helvetica,sans-serif;" size="2">I am in a loop pass, I know the outermost loop. Now How can I get the loopInfo from here? I couldn't find helpful methods in the LoopInfo class documents.</font><br>
<br></font><div><div></div><div><br><div class="gmail_quote">On Mon, Feb 28, 2011 at 5:52 PM, John Criswell <span dir="ltr"><<a href="mailto:criswell@illinois.edu" target="_blank">criswell@illinois.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div text="#000000" bgcolor="#ffffff"><div><div></div><div>
On 2/28/11 4:43 PM, Devang Patel wrote:
<blockquote type="cite"><br>
<div>
<div>On Feb 28, 2011, at 2:35 PM, Naznin Fauzia wrote:</div>
<br>
<blockquote type="cite">Hi all,<br>
<br>
How Can I get the Loops around an Instruction?<br>
<br>
I know I can get the basic block of an instruction using
inst.getParent() which returns a BasicBlock*. Now I want to
use the getLoopFor(BasicBlock) method of the class LoopInfo.<br>
But I dont know how to get the LoopInfo.<br>
<br>
BasicBlock* bb = inst.getParent();<br>
<br>
(... what should I add here?)<br>
<br>
Loop* innerloop = LI -> getLoopFor(bb):<br>
<br>
</blockquote>
<br>
</div>
<div>Two steps:</div>
<div>1) In your pass's getAnalysisUsage(), request LoopInfo.</div>
<div><br>
</div>
<div>
<div><span style="white-space: pre-wrap;"><font face="Courier"> </font></span><font face="Courier">virtual void
getAnalysisUsage(AnalysisUsage &AU) const {</font></div>
<div><span style="white-space: pre-wrap;"><font face="Courier"> </font></span><font face="Courier"> AU.addRequired<LoopInfo>();</font></div>
<div><span style="white-space: pre-wrap;"><font face="Courier"> </font></span><font face="Courier">}</font></div>
<div><br>
</div>
<div>2) In your runOnLoop() method get the analysis.</div>
<div><br>
</div>
<div><span style="white-space: pre-wrap;"><font face="Courier"> </font></span><font face="Courier">LoopPass *</font><span style="white-space: pre-wrap;"><font face="Courier">LI =
&getAnalysis<LoopInfo>();</font></span></div>
<div><span style="white-space: pre-wrap;"><br>
</span></div>
<div><span style="white-space: pre-wrap;">Now,
you can do LI->getLoopFor(...)</span></div>
</div>
</blockquote>
<br></div></div>
To add to what Devang has said, you may find the doxygen docs on
LoopInfo helpful:<br>
<br>
<a href="http://llvm.org/doxygen/classllvm_1_1LoopInfo.html" target="_blank">http://llvm.org/doxygen/classllvm_1_1LoopInfo.html</a><br>
<br>
-- John T.<br>
<br>
<br>
<blockquote type="cite">
<div>
<div><span style="white-space: pre-wrap;"><br>
</span></div>
<div><span style="white-space: pre-wrap;">-</span></div>
<div><span style="white-space: pre-wrap;">Devang</span></div>
<div><br>
</div>
</div>
<br>
</blockquote>
<br>
</div>
</blockquote></div><br>
</div></div><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>
<br></blockquote></div><br><br clear="all"><br>-- <br><br><div>Thanks,</div><div><br></div><font color="#888888"><div>Justin Holewinski</div><br>
</font></blockquote></div><br>