[llvm-dev] Exception handling support for a target

陳韋任 via llvm-dev llvm-dev at lists.llvm.org
Tue Jan 16 04:23:53 PST 2018

2018-01-16 18:18 GMT+08:00 Tim Northover <t.p.northover at gmail.com>:

> On 15 January 2018 at 12:49, 陳韋任 via llvm-dev <llvm-dev at lists.llvm.org>
> wrote:
> >   - CFI directives:
> >
> >     This is for .eh_frame section. Basically all the targets insert CFI
> > directives in FrameLowering, but I am not sure exactly when/where I
> should
> > do so.
> The directives are there to describe where the unwinder should look to
> find out what each register's value was when this function was called
> (well, each register that the caller expected to be preserved). So the
> directives have to have been emitted by the time any instruction is
> executed that could cause an exception to be thrown (typically either
> a call to another function or a compiler-generated call to __cxa_throw
> or similar when the source code itself contains "throw X").
> So normally the directives are emitted in the prologue when the
> registers actually get saved. Sometimes all in a bunch, sometimes
> interspersed with the saves, but it usually doesn't matter which. As
> you've discovered that happens in XYZFrameLowering

​Do we have to emit directives in the epilogue, too?​ One of my test case
fail due to the directives in the epilogue have been executed. After remov
 them from epilogue, the exception is caught as expected. Also, the
directives are also for debug purpose (.debug_frame), right? I guess I only
have to make sure directives work for exception handling, then debug works
as well?

Wei-Ren Chen (陳韋任)
Homepage: https://people.cs.nctu.edu.tw/~chenwj
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180116/fedda1a7/attachment.html>

More information about the llvm-dev mailing list