Open llvmbot opened 7 years ago
Have now tested LLVMBuildCallInPad, and it works. I don't think I need LLVMBuildInvokeInPad.
third version of patch, including LLVMBuild*InPad() My cleanuppad blocks need to call/invoke other functions (typically a finally block in a try/finally is compiled into a function), which means they need to generate "funclet operand bundles" and attach them to call/invoke instructions. These two new functions are intended to allow that from LLVM-C (but I haven't yet tested them).
No, that won't work, will it, because the cleanupret just tells the personality where to unwind to next. So I'll create a patch which implements LLVMBuildCallWithFuncletBundle() and LLVMBuildInvokeWithFuncletBundle().
Also can't make funclet operand bundles for cleanuppads which make function calls (e.g. for "finally" blocks). I don't have a patch for this yet. I think I can workaround that by doing a cleanupret to a new basic block and make the call from there.
second version of patch, including LLVMConstTokenNone() Patch including LLVMConstTokenNone().
To make catchpad and cleanuppad useful, we also need the constant token none, and there is no way of getting that from LLVM-C either. I'll make a new patch in the morning.
Extended Description
The LLVM-C interface provides no means to construct catchswitch, catchpad, catchret, cleanuppad, or cleanupret instructions.
Patch file attached. I haven't tested this yet because of LLVM build problems on my machine which I am sorting out now. I will test it today or tomorrow. More functionality could be added for catchswitch handlers, similar to the clause functionality for landingpads, but this will be enough to allow us to start using these instructions.