<div dir="ltr">I am using llvm-prof. It prints very nice BB freq summaries. <div>Ex: Top 20 most frequently executed basic blocks:</div><div><br></div><div> ## %% <span class="" style="white-space:pre"> </span>Frequency</div><div> 1. 32.3232% 32/99<span class="" style="white-space:pre"> </span>_Z12func_sin_cosdd() - entry</div><div> 2. 32.3232% 32/99<span class="" style="white-space:pre"> </span>main() - for.body</div><div> 3. 32.3232% 32/99<span class="" style="white-space:pre"> </span>main() - for.body14</div><div> 4. 1.0101% 1/99<span class="" style="white-space:pre"> </span>main() - entry</div><div> 5. 1.0101% 1/99<span class="" style="white-space:pre"> </span>main() - for.cond12.preheader</div><div> 6. 1.0101% 1/99<span class="" style="white-space:pre"> </span>main() - for.end20</div><div><br></div><div><a href="http://llvm.org/releases/2.1/docs/CommandGuide/html/llvm-prof.html">http://llvm.org/releases/2.1/docs/CommandGuide/html/llvm-prof.html</a> [I am using llvm 3.3].<br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Sep 6, 2014 at 8:43 PM, Vanderson Martins do Rosario <span dir="ltr"><<a href="mailto:vandersonmr2@gmail.com" target="_blank">vandersonmr2@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br></div>