Call vs Invoke in LLVM IR codes

I have three questions:

1) What are the differences between Invoke and Call operations in LLVM IR codes?

2) Why is a call to a call not considered a Terminator operation in BasicBlocks here ?

3) Is it possible for both Invoke and Call operators to make indirect calls in assembly level language?

Thank you in advance,

+6
source share
2 answers

1) R \ Invoke is a function call that can throw an exception. If you understand, call the block definition for descriptor exceptions, and the other to continue the normal flow.

2) R \ Call instructions are not considered terminator instructions, because the control flow is transferred to another function. In LLVM, the terminator command should reflect the following (or more than one) base blocks that may be excluded.

3) R \ Sorry, I do not know

+7
source

Regarding 3), it is unclear whether you ask wrt by writing a) your own backend or b) regarding an existing backend.

a) yes, obviously / usually you can generate whatever you want if you implement it in your backend. b) which backend? those. calling ARM is already an indirect branch (for example, the bl instruction), while the X86 CALL has side effects on the H86 HW (i.e., saving the return address, as well as non-functional side effects, such as support for predicting column branches) and therefore cannot be simply replaced by an indirect call without emulating what CALL would do. AFAIK CALL emulation using indirect branches is not part of the X86 LLVM backend.

+1
source

All Articles