<div dir="ltr"><div><div><div>I'd like to thank Tim and David for answering this and Chenwj for asking.<br><br></div>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.<br><br></div>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 <a href="http://llvm.org/docs/ExceptionHandling.html">http://llvm.org/docs/ExceptionHandling.html</a> (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.<br><br></div>Nemanja<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 16, 2018 at 11:39 AM, David Chisnall via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 16 Jan 2018, at 10:18, Tim Northover via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br>
><br>
>>  Is the above list complete? Do I understand their purpose correctly (sort<br>
>> of)?<br>
><br>
> There are components in libunwind (especially) and compiler-rt you'll<br>
> also need to look at if you're not on top of an existing runtime.<br>
<br>
</span>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:<br>
<br>
struct MyArch_Regs<br>
{<br>
        int64_t GPRs[32];<br>
};<br>
<br>
And the get function is just doing GPRs[RegNo - MyArch_GPR0].<br>
<br>
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.<br>
<br>
David<br>
<div class="HOEnZb"><div class="h5"><br>
______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
</div></div></blockquote></div><br></div>