Chuck Zhao
2011-Jan-06 17:21 UTC
[LLVMdev] Identify Loops from within FunctionPass, or possible to intermix different types of Passes?
LLVMers, I have a traversal plan which needs to visit certain types of Functions. For each instruction in such functions, I will need to know: 1. is it located inside a loop 2. if yes, what level of loop nest it is currently in. 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. Is there a reasonably simple way to identify loop(s) within a function under FunctionPass? (Any existing LLVM code that I can take a look?) OR Is it possible to intermix different types of LLVM Passes? E.g. class MyPass: public FunctionPass, public LoopPass{ ... public: bool runOnFunction(...); bool runOnLoop(...); ... }; Does this make any sense? I haven't seem to find any existing LLVM pass under such uses. Thank you very much Chuck -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110106/b003904a/attachment.html>
Devang Patel
2011-Jan-06 19:24 UTC
[LLVMdev] Identify Loops from within FunctionPass, or possible to intermix different types of Passes?
On Jan 6, 2011, at 9:21 AM, Chuck Zhao wrote:> LLVMers, > > I have a traversal plan which needs to visit certain types of Functions. For each instruction in such functions, I will need to know: > 1. is it located inside a loop > 2. if yes, what level of loop nest it is currently in. > > 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. > > Is there a reasonably simple way to identify loop(s) within a function under FunctionPass? > > (Any existing LLVM code that I can take a look?)Your FunctionPass can use LoopInfo to get this information. - Devang> > OR > > Is it possible to intermix different types of LLVM Passes? > > E.g. > > class MyPass: public FunctionPass, public LoopPass{ > ... > public: > bool runOnFunction(...); > bool runOnLoop(...); > ... > }; > > Does this make any sense? > I haven't seem to find any existing LLVM pass under such uses. > > > Thank you very much > > Chuck > > _______________________________________________ > 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/20110106/8eef7199/attachment.html>
Jeff Kunkel
2011-Jan-06 20:06 UTC
[LLVMdev] Identify Loops from within FunctionPass, or possible to intermix different types of Passes?
I've never seen a LoopPass, but doing a function pass and grab the loop info from "\llvm\Analysis\LoopInfo.h".>From there just you use the LoopInfo api to grap the loop headers and loopblocks and whatever else you want to do. - Thank Jeff Kunkel On Thu, Jan 6, 2011 at 2:24 PM, Devang Patel <dpatel at apple.com> wrote:> > On Jan 6, 2011, at 9:21 AM, Chuck Zhao wrote: > > LLVMers, > > I have a traversal plan which needs to visit certain types of Functions. > For each instruction in such functions, I will need to know: > 1. is it located inside a loop > 2. if yes, what level of loop nest it is currently in. > > 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. > > Is there a reasonably simple way to identify loop(s) within a function > under FunctionPass? > > (Any existing LLVM code that I can take a look?) > > > Your FunctionPass can use LoopInfo to get this information. > > - > Devang > > > OR > > Is it possible to intermix different types of LLVM Passes? > > E.g. > > class MyPass: public FunctionPass, public LoopPass{ > ... > public: > bool runOnFunction(...); > bool runOnLoop(...); > ... > }; > > Does this make any sense? > I haven't seem to find any existing LLVM pass under such uses. > > > Thank you very much > > Chuck > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > > > _______________________________________________ > 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/20110106/5ae345ce/attachment.html>
Seemingly Similar Threads
- [LLVMdev] Identify Loops from within FunctionPass, or possible to intermix different types of Passes?
- [LLVMdev] Problem in accessing Loops in other Functions Problem in accessing Loops in other Functions problem in accessing the Loops in other functions
- [LLVMdev] LoopInfo of a basic block
- [LLVMdev] get LPPassManager to use it in llvm::CloneLoop
- [LLVMdev] LoopInfo of a basic block