<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE></TITLE>
<META content="text/html; charset=GB2312" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.19019"></HEAD>
<BODY bgColor=#ffffff text=#000000>
<DIV><FONT size=2 face=Arial>Sorry for the spaming. I solved that problem, which
is caused by my typo....</FONT></DIV>
<BLOCKQUOTE
style="BORDER-LEFT: #000000 2px solid; PADDING-LEFT: 5px; PADDING-RIGHT: 0px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="FONT: 10pt arial; BACKGROUND: #e4e4e4; font-color: black"><B>From:</B>
<A title=zhangwen@cse.ohio-state.edu
href="mailto:zhangwen@cse.ohio-state.edu">Wenbin Zhang</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=criswell@illinois.edu
href="mailto:criswell@illinois.edu">John Criswell</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Cc:</B> <A title=llvmdev@cs.uiuc.edu
href="mailto:llvmdev@cs.uiuc.edu">llvmdev@cs.uiuc.edu</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Thursday, March 03, 2011 5:26
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [LLVMdev] how can I have
LoopInfo in a module pass?</DIV>
<DIV><BR></DIV>
<DIV><FONT size=2 face=Arial>I think this assertion failure may be caused by
the getAnalysisUsage(). Mine is like the following:</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>class myclass : public ModulePass{</FONT></DIV>
<DIV><FONT size=2 face=Arial> ...</FONT></DIV>
<DIV><FONT size=2 face=Arial> virtual void
getAnalysisUsage(AnalysisUsage &AU) const
{<BR>
AU.addRequired<LoopInfo>();<BR> }</FONT></DIV>
<DIV><FONT size=2 face=Arial> ...</FONT></DIV>
<DIV><FONT size=2 face=Arial>}</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>Is it enough? Thanks!</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>Best,</FONT></DIV>
<DIV><FONT size=2 face=Arial>--Wenbin</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<BLOCKQUOTE
style="BORDER-LEFT: #000000 2px solid; PADDING-LEFT: 5px; PADDING-RIGHT: 0px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="FONT: 10pt arial; BACKGROUND: #e4e4e4; font-color: black"><B>From:</B>
<A title=zhangwen@cse.ohio-state.edu
href="mailto:zhangwen@cse.ohio-state.edu">Wenbin Zhang</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=criswell@illinois.edu
href="mailto:criswell@illinois.edu">John Criswell</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Cc:</B> <A title=llvmdev@cs.uiuc.edu
href="mailto:llvmdev@cs.uiuc.edu">llvmdev@cs.uiuc.edu</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Thursday, March 03, 2011 5:04
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [LLVMdev] how can I have
LoopInfo in a module pass?</DIV>
<DIV><BR></DIV>
<DIV><FONT size=2 face=Arial>Thanks John, I modify my code to like
this:</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>bool XXX::ModulePass(Module
&M){</FONT></DIV>
<DIV><FONT size=2 face=Arial> ....</FONT></DIV>
<DIV><FONT size=2 face=Arial> LoopInfo &li =
getAnalysis<LoopInfo>(fi);</FONT></DIV>
<DIV><FONT size=2 face=Arial> ....</FONT></DIV>
<DIV><FONT size=2 face=Arial>}</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>Here fi is a Function* pointing to
main().</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>Now when I run the pass, another error shows
up:</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial><EM>AnalysisType&
llvm::Pass::getAnalysisID(const llvm::PassInfo*, llvm::Function&) [with
AnalysisType = llvm::LoopInfo]: Assertion `ResultPass && "Unable to
find requested analysis info"' failed.</EM></FONT></DIV>
<DIV><EM><FONT size=2 face=Arial></FONT></EM> </DIV>
<DIV><FONT size=2 face=Arial>Did I miss something? Thanks!</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>Best,</FONT></DIV>
<DIV><FONT size=2 face=Arial>--Wenbin</FONT></DIV>
<BLOCKQUOTE
style="BORDER-LEFT: #000000 2px solid; PADDING-LEFT: 5px; PADDING-RIGHT: 0px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="FONT: 10pt arial; BACKGROUND: #e4e4e4; font-color: black"><B>From:</B>
<A title=criswell@illinois.edu href="mailto:criswell@illinois.edu">John
Criswell</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
title=zhangwen@cse.ohio-state.edu
href="mailto:zhangwen@cse.ohio-state.edu">Wenbin Zhang</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Cc:</B> <A title=llvmdev@cs.uiuc.edu
href="mailto:llvmdev@cs.uiuc.edu">llvmdev@cs.uiuc.edu</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Thursday, March 03, 2011 4:26
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [LLVMdev] how can I have
LoopInfo in a module pass?</DIV>
<DIV><BR></DIV>On 3/3/11 3:09 PM, Wenbin Zhang wrote:
<BLOCKQUOTE cite=mid:85078525D9154266BF80CC611DE857F8@osuc90d096e394
type="cite">
<META name=GENERATOR content="MSHTML 8.00.6001.19019">
<STYLE></STYLE>
<DIV><FONT size=2 face=Arial>Hi all,</FONT></DIV>
<DIV><FONT size=2 face=Arial>I tried to have a LoopInfo object in a
function pass, add addRequired<LoopInfo> in getAnalysisUsage,
and then use getAnalysis<LoopInfo> in runOnFunction(). It worked
OK.</FONT></DIV>
<DIV><FONT size=2 face=Arial>Now I want to have a module pass to
traverse the functions, and similarly I want to have to loop information
of the functions. When I did the above in runOnModule, and run the pass,
the following error popped out:</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2 face=Arial><EM>AnalysisType&
llvm::Pass::getAnalysis() const [with AnalysisType =
llvm::DominatorTree]: Assertion `Resolver && "Pass has not been
inserted into a PassManager object!"' failed.</EM></FONT></DIV>
<DIV><EM></EM> </DIV>
<DIV><FONT size=2 face=Arial>Can anyone tell me the correct way to
handle this in a module pass? Thanks a
lot!</FONT></DIV></BLOCKQUOTE><BR>LoopInfo is a FunctionPass, so you have
to use getAnalysis<LoopInfo>(F) where F is a pointer to the function
that you want analyzed.<BR><BR>Note that LoopInfo, in this instance, will
be re-run every time you call getAnalysis on it (this is a result of using
a FunctionPass within a ModulePass). Be sure to structure you code
to only call getAnalysis<LoopInfo>(F) on each function just once, if
possible.<BR><BR>Also be sure that F is not a function declaration (i.e.,
a function with no body).<BR><BR>-- John T.<BR><BR>
<BLOCKQUOTE cite=mid:85078525D9154266BF80CC611DE857F8@osuc90d096e394
type="cite">
<DIV> </DIV>
<DIV><FONT size=2 face=Arial>Best,</FONT></DIV>
<DIV><FONT size=2
face=Arial>--Wenbin</FONT></DIV></BLOCKQUOTE><BR></BLOCKQUOTE>
<P>
<HR>
<P></P>_______________________________________________<BR>LLVM Developers
mailing
list<BR>LLVMdev@cs.uiuc.edu
http://llvm.cs.uiuc.edu<BR>http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev<BR></BLOCKQUOTE>
<P>
<HR>
<P></P>_______________________________________________<BR>LLVM Developers
mailing
list<BR>LLVMdev@cs.uiuc.edu
http://llvm.cs.uiuc.edu<BR>http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev<BR></BLOCKQUOTE></BODY></HTML>