<div dir="ltr">Hi everyone,<br><br>I have been studying llvm for the last two weeks and I got stuck in some topics. I'm a little lost about where to look for information, for this reason I'm asking here. Sorry if it's not the right place to do that.<br><br>I managed to do a toy compiler with bison and llvm, but now I need to do some others things:<br><br>1) I need discover the amount of times that each basic block is executed.<br>I tried to use the BlockFrequencyInfo but I think I'm doing some thing wrong:<br> ....<br> BlockFrequencyInfo* BFI = new BlockFrequencyInfo();<br> FunctionPassManager FPM(module);<br> FPM.add(BFI);<br> FPM.doInitialization();<br><br> for(auto& func : *module) {<br> FPM.run(func);<br> for(auto& bb : func) <br> std::cout << BFI->getEntryFreq() << std::endl;<br> }<br><br>This code just prints 0.<br><br>And for example, if I want to do it (get the BasicBlock frequency) dynamically how could I proceed?<br><br>2) I saw that there is a MachineBasicBlock, what do I need to study to be able to get this blocks from BasicBlock?<br><br>Thank you,<br><br clear="all"><div><div><div><div dir="ltr"><span style="color:rgb(102,102,102)">Vanderson M. Rosario</span><br></div></div>
</div></div></div>