iterate over loops inside the runOnFunction

Hello
I’m wandring to write a Function parser that iterates over loops inside each function and inside each loop iterates over instructions

So I found a way to do the Function parser that iterates over BasicBlocks (using the runOnfunction Pass) but I no know how make it iterates over loops ?

So my question is there any way to make a loop inside the runOnfunction to iterate over “loops” (just like with the Basicblock loop "for (BasicBlock::iterator i = b->begin(), ie = b->end(); i != ie; ++i) " ) ?

Thank you so much for helping me

Here is an example. You can also check lib/Scalar/LoopUnroll.cpp.