fateme Hoseini via llvm-dev
2015-Nov-23 20:29 UTC
[llvm-dev] get basic blocks inside a machine code loop
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>
Krzysztof Parzyszek via llvm-dev
2015-Nov-23 20:35 UTC
[llvm-dev] get basic blocks inside a machine code loop
On 11/23/2015 2:29 PM, fateme Hoseini via llvm-dev wrote:> 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.MachineLoop is a subclass of LoopBase, which is a template and defines getBlocks for the specified block type. -Krzysztof -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation