[llvm-dev] Get the address of basic block (mapping to llvm ir)

PenYiWang via llvm-dev llvm-dev at lists.llvm.org
Thu Mar 5 01:55:30 PST 2020


I want to get the address of basic block in llvm ir ,

so I use and BlockAddress,

and then use GlobalVariable 's setInitializer to pass it to my own program.

but I found that BlockAddress sometime would be wrong.

Because code gen (llvm backend) is free to insert instructions in to bb,

like "mov rax" or "add rsp".

and even change the order of basic block .

like this:

[llvm-dev] Is BlockAddress always correct ?

Then, I study some discussion in llvm-dev

[llvm-dev] Figuring out return address of a call

[llvm-dev] Stackmap question

I also study the shadow stack paper in SP'19, but it is purely in llvm
backend , right ?

After survey, I found that BlockAddress and patchpoint/stack map both can't
exactly get the address of basic block , especially the basic block is
before a call instruction.

Have you solved this problem?
Or get the address of basic block in other way ?

Thank you ~
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200305/0ff5280d/attachment.html>

More information about the llvm-dev mailing list