[LLVMdev] Alternative exception handling proposal

John McCall rjmccall at apple.com
Thu Dec 2 10:05:58 PST 2010


On Dec 2, 2010, at 4:45 AM, Duncan Sands wrote:
>> I'm unhappy about how this bakes _Unwind_Resume into the backend, particularly
>> since that prevents us from using better alternatives when they're available
>> (e.g. the ARM EH ABI's _cxa_end_cleanup(), which saves code size by not requiring
>> the exception pointer, but which we can only use if we're linking in the C++ standard
>> library).
> 
> the code generators can lower "unwind" to a call to _cxa_end_cleanup on that
> platform.

No, they can't, it's language-library-specific.  Only the frontend knows whether it's safe to
introduce that dependency.

Also, _Unwind_Resume has a slightly different name in ARM sjlj EH;  it would be great
if codegen didn't have to hard-code all this again.

>> One idea that comes to mind is that we could make Yet Another call-like instruction,
>> a terminator like 'invoke' but with no successors and with the special
>> replaced-with-a-branch behavior when inlined through an invoke.  So the front-end
>> could call whatever function it pleases, taking responsibility for passing in the right
>> information.
> 
> I think this is way too complicated.

Then instead of using a call, it can be a special kind of unconditional branch which
the inliner rewrites into a normal branch;  that would look exactly like your "rewind"
instruction except for having a successor.

John.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101202/c2f3d11c/attachment.html>


More information about the llvm-dev mailing list