hameeza ahmed via llvm-dev
2019-Jan-20 11:31 UTC
[llvm-dev] Basic Blocks of a Function called inside Loop
Hello, I have written pass to know basic blocks inside loops.. But for eg a function is called inside loop then all its basic block are also considered part of the loop... I am unable to detect that... How to do so? BB0.....if BB0 is part of Func0 and Func0 is called inside loop (L1) with 10 iterations then BB0 will be executed 10 times... How to detect in LLVM pass that BB0 is inside loop L1? Please help.. Regards -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190120/5e8ac3c8/attachment.html>
hameeza ahmed via llvm-dev
2019-Jan-21 00:34 UTC
[llvm-dev] Basic Blocks of a Function called inside Loop
Thank You... Can you please share the code. On Mon, Jan 21, 2019 at 10:11 AM Jonathan Smith <jvstech+llvm at gmail.com> wrote:> The way I do it is to iterate over each of the instructions in the > relevant blocks, find all the call sites, then repeat the same thing > for all of the blocks in the called functions until there are no call > sites left. There may be a better way to do it, but this is the method > that works for me. It's also fully recursive, which may or may not be > what you want. >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190121/3a5277ea/attachment.html>
Jonathan Smith via llvm-dev
2019-Jan-21 05:10 UTC
[llvm-dev] Basic Blocks of a Function called inside Loop
The way I do it is to iterate over each of the instructions in the relevant blocks, find all the call sites, then repeat the same thing for all of the blocks in the called functions until there are no call sites left. There may be a better way to do it, but this is the method that works for me. It's also fully recursive, which may or may not be what you want.