[LLVMdev] About unwind...
Jonathan Brandmeyer
jbrandmeyer at earthlink.net
Sun Dec 16 09:44:13 PST 2007
On Sun, 2007-12-16 at 16:57 +0100, Duncan Sands wrote:
> > 2) When I unwind, the stack gets popped but it would make sense to pass some
> > data to the exception handler. I guess I could use a global variable for
> > this, but is there a way to do it on the stack? (Wouldn't that make more
> > sense also?)
>
> Passing extra info on the stack doesn't make much sense because the stack
> gets popped...
>
> Also, note that the unwind instruction is currently turned into an abort
> call at codegen time!
>
> I suggest you compile some C++ code with exception handling using
> llvm-g++ -S -emit-llvm and see how it does it. In short: throwing
> an exception is done by a library call which takes an exception object.
> Catching is done using the LLVM invoke instruction. The exception
> object is retrieved by an llvm.eh.exception intrinsic call. See
> http://llvm.org/docs/ExceptionHandling.html
The current llvm.eh intrinsics use c++ type_info objects and the c++
personality function for the Itanium ABI unwinder. What is the best way
for a new language to portably maximize reuse of the existing C++
runtime? Can you use a pointer to some other object and expect the
unwinder to work, or does the personality function inspect the contents
of the type_info as well as its address? Or do you have to write a new
personality function? Is there an example of a non-C++ llvm front-end
that also uses the llvm eh support?
Thanks,
-Jonathan
More information about the llvm-dev
mailing list