[LLVMdev] RFC: New Exception Handling Proposal

Bill Wendling wendling at apple.com
Tue Nov 24 16:00:36 PST 2009


On Nov 24, 2009, at 2:21 PM, Sandeep Patel wrote:

> On Wed, Nov 18, 2009 at 10:22 PM, Bill Wendling <wendling at apple.com>  
> wrote:
>> The current exception handling mechanism encodes the exception
>> handling metadata
>> by using intrinsics and the CFG itself.
> ...
>> Exception handling metadata is no longer encoded in the CFG. It is
>> much more
>> sanely specified, and thus easier to understand by normal humans. The
>> optimizers
>> are free to modify the code as they see fit. In fact, they may be  
>> able
>> to do a
>> better job at it. For instance, they could perform optimizations
>> mixing the
>> cleanup and catch code. If the "filters" were part of the function
>> instead of an
>> intrinsic, there is the potential for optimizations based upon
>> knowledge that a
>> function cannot throw a particular type.
>
> Catch blocks are attractive targets for hot/cold optimizations of
> various kinds (-Os, move the block to a different VM page, Thumb ISA
> vs ARM ISA, etc.)
>
> If EH isn't modeled directly on the CFG, how can these optimizations  
> be handled?
>
Exception handling is still modeled directly in the CFG. That is,  
there are unique branches to catches, cleanups, etc. from a call that  
may throw. The only thing which isn't encoded in the CFG anymore is  
the metadata involved with EH. Things like specifying what is a  
landing pad, what is a post pad, etc., which are entities that code  
gen generates for whatever type of EH mechanism is being used. All of  
the optimizations you mention here will still be doable with the new  
scheme.

-bw




More information about the llvm-dev mailing list