Hello,
I’m wondering how I could implement a LLVM backend pass to figure out the possible destination labels of each indirect jump, and dump that information out.
For example, if LLVM were to generate assembly
jmpq *.LJTI0_0(,%rcx,8)
.LJTI0_0:
.quad .LBB0_4
.quad .LBB0_54
.quad .LBB0_48
.quad .LBB0_26
At LLVM backend level, LLVM clearly knows that the jump has 4 target labels (LBB0_4/54/48/26). So I’m wondering how I could dump that information out with a backend pass.
I have tried to follow the tutorial for LLVM backend pass months ago, but just couldn’t make that work. Maybe I should give it another try, but I’m wondering what is the easiest way to do this.
P.S. this is the follow up of a previous post. I am currently using the debug info hack as mentioned in that post, but have since then encountered more and more edge case bugs… So I’m wondering how I could do this in the proper way (a LLVM backend pass).
Thanks!