[LLVMdev] RFC: Exception Handling Proposal Revised

John McCall rjmccall at apple.com
Wed Dec 1 00:25:21 PST 2010


On Dec 1, 2010, at 12:15 AM, Bill Wendling wrote:

> On Dec 1, 2010, at 12:10 AM, John McCall wrote:
> 
>> On Nov 30, 2010, at 11:04 PM, Bill Wendling wrote:
>>> • A landing pad must have exactly one dispatch instruction associated with it,
>>> and it must dominate that instruction.
>> 
>> Okay, but how do we find it?
>> 
> We can modify the dispatch to point back to the landing pad it's associated with. Something like:
> 
> lpad: landingpad
>  dispatch region label %lpad ...
> 
> or similar.

Okay.  So passes (like codegen's EH preparation) that want to track what landing pads go to what dispatches will just have to walk the basic blocks and look for blocks terminated in "dispatch"?  That seems mostly reasonable.

One problem I foresee is that it's possible for a dispatch block to become unreachable from its landing pad.  If that block is then deleted, we'd lose information about what's supposed to unwind there.  This could happen if, e.g., someone had a noreturn destructor.  In languages that usefully allow throws from EH destructors (i.e. Ada) I can imagine uses for this, and regardless it's well-formed code that shouldn't cause the world to explode.

John.



More information about the llvm-dev mailing list