[LLVMdev] Question LowerSetJmp

Duncan Sands baldrick at free.fr
Thu Feb 26 00:57:20 PST 2009


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.



More information about the llvm-dev mailing list