[LLVMdev] nonlocal go to -- how?

Duncan Sands baldrick at free.fr
Mon May 5 07:37:03 PDT 2008


Hi,

> The problem with this is that it places a lot of overhead on every 
> function call and return.  The alternative mechanisms involving 
> exceptions, while more complex, involve overhead only for functions that 
> actually involve labels (which are rare in practise).

correct, the dwarf exception mechanism would only add serious overhead when
you perform a non-local goto.

> Or am I wrong on this.? Does every call through which an exception might 
> pass have to be implemented by an invoke, even though the code there 
> knows nothing whatsoever about exceptions?

No.  The exception just winds up out of normal calls.  Invoke is only
needed when you want to catch an exception.

> Might functions with no try,  
> catch, or throw in their code still have to perform calls using invoke 
> instead of call in case their callee might throw an exception straight 
> through them to a faraway outer function?

No, except to perform things like automatic object finalization (cleanups)
in which case cleanup code in the function needs to be run if an exception
unwinds through the function, even if you don't want to catch it there.

> So this makes me ask, is the C++ exception handling implemented?  If so, 
> I might be able to use it instead of my own.

It is implemented.  Take a look at what llvm-g++ -S -emit-llvm gives you.

Ciao,

Duncan.



More information about the llvm-dev mailing list