Hi, I notice that there are several different methods called inside getAnalysisUsage(). The parameters of addRequiredID and addPreservedID are passID. What is the difference between Required and Preserved? There are also function named addRequired<PassName>() called. What is the difference between addRequired<PassName>() and addRequiredID(PassID)? Thanks a lot! Best, Linhai
On 9/29/14, 5:51 PM, songlh wrote:> Hi, > > I notice that there are several different methods called inside > getAnalysisUsage(). The parameters of addRequiredID and addPreservedID > are passID. What is the difference between Required and Preserved?A Required pass is one that must be run before the pass requiring it. The required pass is an analysis pass that your pass will query for analysis information. This information is used by the PassManager to determine which analysis passes must be run before another analysis or optimization pass. A Preserved pass is an analysis pass whose analysis results your pass does not modify. For example, a pass may modify the code in a way that does not modify the results of a dominator analysis. The PassManager uses this information to avoid rerunning expensive analyses unnecessarily.> There are also function named addRequired<PassName>() called. What is > the difference between addRequired<PassName>() and addRequiredID(PassID)?I suspect that addRequired<PassName>() and addRequiredID() do the same thing but have different inputs. When writing a pass, you should just use addRequired<PassName>(); I've never seen anyone use addRequiredID(). Regards, John Criswell
addRequiredID is only used when PassName is not statically known. There's an example in PassPrinters.cpp. I agree with John that you should use addRequired<PassName> whenever possible. Jingyue On Mon Sep 29 2014 at 4:26:25 PM John Criswell <jtcriswel at gmail.com> wrote:> On 9/29/14, 5:51 PM, songlh wrote: > > Hi, > > > > I notice that there are several different methods called inside > > getAnalysisUsage(). The parameters of addRequiredID and addPreservedID > > are passID. What is the difference between Required and Preserved? > > A Required pass is one that must be run before the pass requiring it. > The required pass is an analysis pass that your pass will query for > analysis information. This information is used by the PassManager to > determine which analysis passes must be run before another analysis or > optimization pass. > > > A Preserved pass is an analysis pass whose analysis results your pass > does not modify. For example, a pass may modify the code in a way that > does not modify the results of a dominator analysis. The PassManager > uses this information to avoid rerunning expensive analyses unnecessarily. > > > There are also function named addRequired<PassName>() called. What is > > the difference between addRequired<PassName>() and addRequiredID(PassID)? > > I suspect that addRequired<PassName>() and addRequiredID() do the same > thing but have different inputs. When writing a pass, you should just > use addRequired<PassName>(); I've never seen anyone use addRequiredID(). > > Regards, > > John Criswell > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140929/6ca9cc22/attachment.html>
Seemingly Similar Threads
- [LLVMdev] How to call some transformation passes (LoopRotate and LoopUnroll) from my own pass
- [LLVMdev] Function Pass Manager
- [LLVMdev] Function Pass Manager
- [LLVMdev] YSU_Student
- [LLVMdev] How to call some transformation passes (LoopRotate and LoopUnroll) from my own pass