[llvm-dev] Exception handling support for a target

Nemanja Ivanovic via llvm-dev llvm-dev at lists.llvm.org
Tue Jan 16 03:28:15 PST 2018


I'd like to thank Tim and David for answering this and Chenwj for asking.

I personally don't know much at all about exception handling in LLVM - it's
something that was implemented for my target before I started working on
it. The information you provided is concise, clear and a great start for
getting a handle on how it all comes together in the back end.

In addition to thanking you for providing the info, I'm writing in the
hopes that there is some documentation that exists or that someone is
willing to add to http://llvm.org/docs/ExceptionHandling.html (or a more
appropriate place with a link there) that would cover the back end
(target-specific) aspects of EH. Perhaps just a quick description of what a
target needs to do to get EH working.

Nemanja

On Tue, Jan 16, 2018 at 11:39 AM, David Chisnall via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> On 16 Jan 2018, at 10:18, Tim Northover via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
> >
> >>  Is the above list complete? Do I understand their purpose correctly
> (sort
> >> of)?
> >
> > There are components in libunwind (especially) and compiler-rt you'll
> > also need to look at if you're not on top of an existing runtime.
>
> The libUnwind parts are relatively small.  You need to write two assembly
> functions, one which dumps all registers to memory and one which restores
> them.  Next you need to add enum values for all of your registers that
> correspond to their DWARF register numbres.  You then need to implement a
> C++ class that sets and gets register values from the in-memory structure
> based on the DWARF number.  This is usually quite small because the easiest
> way of dumping the registers is to store each register set contiguously in
> memory in the same order that as their DWARF numbers, so you end up with a
> struct something like this:
>
> struct MyArch_Regs
> {
>         int64_t GPRs[32];
> };
>
> And the get function is just doing GPRs[RegNo - MyArch_GPR0].
>
> LLVM’s libUnwind has a very clean structure.  Adding MIPS support took a
> couple of hours.  All of the unwinder support is generic other than the
> mapping from DWARF register numbers to some concrete mechanism for getting
> and setting them.
>
> David
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180116/6919d1a9/attachment.html>


More information about the llvm-dev mailing list