[LLVMdev] Exception Handling Tables Question

Duncan Sands baldrick at free.fr
Mon Sep 14 06:50:57 PDT 2009

Hi Bill,

> Right now we generate call sites for all of the code in a function,  
> even for code that cannot (or at least shouldn't) throw an exception.
> (assume it's all been inlined), the EH handling table for "main" goes  
> from Leh_func_begin1 to Leh_func_end1, marking off each region whether  
> it can throw or not. From my reading of the Exception Tables  
> documentation, this is unnecessary – at least for C++. If a call  
> throws and it doesn't have an entry in the unwind table, then the  
> "terminate()" function is called. Is it fair to assume that there is a  
> similar mechanism for other languages?

in Ada these extra table entries are not needed at all: whether you
have them or not, an exception will continue to unwind.  There is no
calling of "terminate".  In short: you only need a table entry for
invoke calls, i.e. things you want to catch in this function.

The reason to ask this is that
> it could make the EH tables smaller and less cluttered if we elide  
> those areas which we know don't throw (the functions called are marked  
> 'nounwind', etc.).

Sure, that's what the SawPotentiallyThrowing boolean is for.  It is
currently set for any call, but in fact needn't be set for 'nounwind'
calls.  When I wrote this stuff 'nounwind' information wasn't available
at the codegen level, which is why this isn't done.  In case you care,
doing this would not hurt Ada :)



More information about the llvm-dev mailing list