[LLVMdev] One way to support unwind on x86

Anton Korobeynikov anton at korobeynikov.info
Tue Mar 3 01:23:10 PST 2009


Hello, Bjarke

>  *  Provide a pass that raises C++ exception handling to just
>    unwind instructions and thread-local data.
Are you familiar with C++ EH? How would you handle catches? Cleanups?

> Other call frames might be more complex to handle. It depends on the
> moves needed to restore the registers of the previous call frame (the
> caller) and to remove the current frame.
The devil is in details. How would you restore callee-saved registers?
In general, you need to know what they are in the unwind point and
their exact position on stack.

> What do you think about the idea?
The idea looks sane. But only for 'basic' unwind. Otherwise you'll end
with rewriting libgcc unwind runtime.
Also, how

> My last question: Is it possible to implement a flag for the back-end
> that selects which kind of exception handling to use? Ie. my idea
> versus DWARF + libgcc.
EH is complex. For C++ EH you will need to have a frontend support.
Actually, calls to libgcc unwinding runtime is inserted by frontend.
Backend is only responsible for emission of codegen-time information.
So, if you're planning to hack on C++ EH somehow, you will need to
hack on frontend as well.

Have you looked into libunwind? Maybe it will be easy to hook it into
llvm somehow?

-- 
With best regards, Anton Korobeynikov
Faculty of Mathematics and Mechanics, Saint Petersburg State University



More information about the llvm-dev mailing list