[llvm-commits] [llvm] r49006 - in /llvm/trunk/lib: CodeGen/DwarfWriter.cpp CodeGen/LLVMTargetMachine.cpp CodeGen/SelectionDAG/SelectionDAGISel.cpp Target/PowerPC/PPCAsmPrinter.cpp Target/PowerPC/PPCRegisterInfo.cpp Target/X86/X86AsmPrinter.cpp Target/X86/X86RegisterInfo.cpp Transforms/Utils/LowerInvoke.cpp

Dale Johannesen dalej at apple.com
Tue Apr 1 10:14:44 PDT 2008


On Mar 31, 2008, at 10:54 PM, Anton Korobeynikov wrote:

> Dale,
>
>> Emit exception handling info for functions which are
>> not marked nounwind, or for all functions when -enable-eh
>> is set, provided the target supports Dwarf EH.
> Is this correct? Nounwind function can easily require EH information,
> for example:
>
> void foo() {
>  try {
>   bar();
>  } catch(...) {
>   baz();
>  }
> }
>
> foo() can be marked as nounwind, but it requires EH info to be  
> emitted.

Hmm.  llvm-gcc does not, in fact, mark foo() as nounwind.

"nounwind" is derived from gcc's attribute TREE_NOTHROW, defined as:
/* In a FUNCTION_DECL, nonzero means a call to the function cannot throw
    an exception.  In a CALL_EXPR, nonzero means the call cannot  
throw.  */

That looks semantically the same as "nounwind", and the code in cp  
that sets TREE_NOTHROW
seems to be trying to follow this description.  So it may be this is  
working because of a compensating
bug in llvm-gcc.  I'll look further.

It does seem to me that "needs EH info" is a more useful bit of  
information than the current defined semantics.




More information about the llvm-commits mailing list