Malveeka Tewari
2011-May-25 08:49 UTC
[LLVMdev] Running both Function and Loop passes together
Hi I want to write a LLVM pass that transforms loops only if they belong to certain special functions. Right now I have a pass that can transform loops as I intend, but I do not know how to check if the loop is actually contained in one of the special functions. Is there a way to identify the function to which a particular loop belongs ? I am not sure if my pass should implement both runOnLoop and runOnFunction methods or not. I tried implementing a pass that subclasses both Function and Loop Pass, but that didn't seem to work. Any suggestions on the best way to implement such a pass will be extremely helpful. Thanks! Malveeka -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110525/383471c6/attachment.html>
Duncan Sands
2011-May-25 09:19 UTC
[LLVMdev] Running both Function and Loop passes together
Hi Malveeka,> I want to write a LLVM pass that transforms loops only if they belong to certain > special functions. > Right now I have a pass that can transform loops as I intend, but I do not know > how to check if the loop is actually contained in one of the special functions. > Is there a way to identify the function to which a particular loop belongs ?if BB is a basic block (eg: one belonging to the loop) then BB->getParent() will return the enclosing function. Ciao, Duncan.