[LLVMdev] Running both Function and Loop passes together

Duncan Sands baldrick at free.fr
Wed May 25 02:19:37 PDT 2011


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.



More information about the llvm-dev mailing list