<div>Hi,<br></div><div><br></div><div>I am currently looking at unwinding support for inline assembly, which might be useful for a coroutine library I am working on. The idea is that inline assembly may emit a call to a function which might throw/unwind. The current approach for that would be to emit an `invoke` instruction:<br></div><div><br></div><div>```<br></div><div>invoke void asm  "call thrower", "~{dirflag},~{fpsr},~{flags}"()<br></div><div>    to label %exit unwind label %uexit<br></div><div>```<br></div><div><br></div><div>However, Codegen doesn't currently emit proper EH Begin/End labels for this to work (because unwinding requires exception tables). I have experimented with adding the required EH labels to SelectionDAGBuilder, which now emits working code which allows unwinding from inline assembly code.<br></div><div><br></div><div>I was wondering whether there would be support for a patchset (which implements this). I am not quite sure, whether there are sideeffects/invariants I am missing (except for a few places where its assumed that inline asm doesn't throw; like in the Inliner and InstCombineCall pass) or if there is a reason why this isn't possible right now.<br></div><div> <br></div><div>Furthermore, there might be a need to signify that an inline assembly "invoke" might throw. Right now I've implemented this as a change to the invoke syntax (the unwind keyword after asm):<br></div><div><br></div><div>```<br></div><div>invoke void asm sideeffect unwind  "call thrower", "~{dirflag},~{fpsr},~{flags}"()<br></div><div>    to label %exit unwind label %uexit<br></div><div class="protonmail_signature_block protonmail_signature_block-empty"><div class="protonmail_signature_block-user protonmail_signature_block-empty"><br></div><div class="protonmail_signature_block-proton protonmail_signature_block-empty"><br></div></div><div>```<br></div><div><br></div><div>Some feedback on this topic and general direction to this approach would be appreciated!<br></div><div><br></div><div>Regards,<br></div><div>Paul</div>