[LLVMdev] RFC: Exception Handling Proposal II

John McCall rjmccall at apple.com
Sat Nov 27 16:57:49 PST 2010


On Nov 25, 2010, at 3:03 AM, Duncan Sands wrote:
> I'm pointing out that if the invoke instruction
> is removed and catch information is attached to entire basic blocks, then if no
> care is taken then it is perfectly possible to use %x before it is defined as
> explained in my previous email, blowing up the entire LLVM system.  Clearly the
> solution is to not allow this by not allowing values defined in a basic block
> to be used in a handler for that block;

If we take this route — and I think we should, although I'd like to see region
chaining in first — I see two reasonable solutions.  The first is what you've
said, that effectively there's an edge from the beginning of the block;  the
second is a slight twist, that the edge leaves from the end of the phis.  I
think the latter will greatly simplify every transformation which ever inserts
a phi, and in particular mem2reg.  Since phis can't throw, it should be
equivalent anyway.

> In Ada you can throw and exception inside a destructor and it does not lead
> to program termination.

Interesting.  I assume that the personality still sees these as just cleanups,
so this must be implemented by running the destructor in a handler which
aborts both unwinds and throws the Program_Error?

John.



More information about the llvm-dev mailing list