Question LowerSetJmp

Hi
    In llvm src the file llvm/lib/Transforms/IPO/LowerSetJmp.cpp, it
seems for sjlj-eh ? but this pass has no effect about c++ sjlj-eh.
this pass is for future extend?

zhangzw

Hi zhangzw,

    In llvm src the file llvm/lib/Transforms/IPO/LowerSetJmp.cpp, it
seems for sjlj-eh ?

it's not for sjlj-eh. The problem with setjmp/longjmp is that they
can jump from one part of a function to any other part, which means
that the control-flow graph is pointless; this makes everything more
complicated. So how to deal with this? LLVM does have constructs
that allow "jumping around": invoke and unwind, and all the optimizers
know how to deal with these correctly. So LLVM turns setjmp/longjmp
into a bunch of invokes and unwinds, in order to generate correct code
while not having to teach all the optimizers about setjmp/longjmp.
Setjmp/longjmp eh is something different.

but this pass has no effect about c++ sjlj-eh.
this pass is for future extend?

Ciao,

Duncan.

Or virtually identical. Bout the only difference is the number of registers saved and the order of those registers.

Or virtually identical. Bout the only difference is the number of
registers saved and the order of those registers.

What needs to be done to get g++ to use sj/lj style
exception handling?

Thanks,

Duncan.

Many different ways, the easiest, most experimental way would be:

   --enable-sjlj-exceptions
                           arrange to use setjmp/longjmp exception handling

Somehow, I suspect you have additional questions.

Well, I tried --enable-sjlj-exceptions (gcc 4.4) but as far as I
could tell it continued to use dwarf eh. I will try again...

Ciao,

Duncan.