[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

Chris Lattner clattner at apple.com
Tue Apr 1 10:40:28 PDT 2008


On Apr 1, 2008, at 10:14 AM, Dale Johannesen wrote:

>
> 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.

In this case, that is because baz() could throw.  Try:

int foo() {
   try {
     bar();
   } catch(...) {
     return 17
   }
   return 42;
}


>
>
> "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.
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list