[llvm-dev] A volatile question.

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Fri Nov 22 06:06:42 PST 2019


Hi Peter,

On Fri, 22 Nov 2019 at 04:59, Peter McKinna via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> I'm wondering if this is the right stick to use and whether it's too big. A try except
> block might be a small percentage of a function and I might be losing optimisations
> elsewhere.

It's probably the only way if you stick to explicit setjmp/longjmp
style calls, but it is a very nasty hammer. I think you should try to
switch to using LLVM's expected exception path: invoke + landingpad.

For x86, LLVM's expecting to use DWARF-based exception handling; but I
couldn't think of any obvious reason why that's fatal to you. LLVM
emits extra DWARF tables, but you can just ignore (or strip) them and
carry on calling your registration and raise functions. LLVM is happy
because it knows what the real control flow of the function is.

Alternatively, if that fails it might be more backend work than you'd
like but LLVM does know about setjmp/longjmp exceptions so teaching it
about your variant is unlikely to be a huge effort.

Cheers.

Tim.


More information about the llvm-dev mailing list