[llvm-dev] get basic blocks inside a machine code loop
fateme Hoseini via llvm-dev
llvm-dev at lists.llvm.org
Mon Nov 23 12:29:48 PST 2015
Hello everyone,
I am trying to write a pass which works on machine instructions. I need to
get all basic blocks in the loop. I could't find any function like
getblocks for machineloop.
I wrote my code like this:
MachineLoopInfo &MLI = getAnalysis<MachineLoopInfo>();
for (MachineLoopInfo::iterator i = MLI.begin(), e = MLI.end(); i != e; ++i)
{
MachineLoop *ML = *i;
int bbCounter = 0;
loopCounter++;
for(MachineLoop::iterator mbb = ML->begin(); mbb != ML->end(); ++mbb) {
bbCounter+=1;
}
errs() <<"bbcounter" << bbCounter << "\n";
}
errs() << "loopCounter" << loopCounter << "\n";
I used loopcounter and bbcounter to identify if my pass is working
correctly. I run this pass on my test code which has 1 loop with 4 basic
blocks. It returns 1 for loopcounter, but the bbcounter is 0.
It means that my iterator on machineloop does not work. I appreciate any
help with this problem.
Thanks,
Fami
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151123/949c3eba/attachment.html>
More information about the llvm-dev
mailing list