[LLVMdev] Unwinds gone missing

Nick Lewycky nicholas at mxc.ca
Fri Dec 26 08:20:26 PST 2008


Matt Giuca wrote:
> Alastair Lynn wrote:
>   
>>  From what I understand, the unwind instruction is implemented only  
>> for the interpreter: there is a -lowerunwind pass for compiling to  
>> other systems which will either lower unwind and invoke to setjmp/ 
>> longjmp (slow) or turn invokes into calls and unwinds into abort()s.
>>
>>     
>
> Ah cheers, Alastair. That could be very useful (at least for me personally,
> I don't mind the slow so much as long as it behaves correctly!)
>
> I did a bit of research. Looks like it's -lowerinvoke, not -lowerunwind.
>
> http://llvm.org/docs/Passes.html#lowerinvoke
>
> That provides the two options you describe.
>
> Now this question is perhaps getting a bit off-topic, but I can't find a
> tool which accepts the -lower* arguments. Is there a tool for running such
> passes? Or can it only be accessed from the C++ API side of LLVM?
>   
opt. You can use it like:

  $ opt -lowerinvoke in.bc -o out.bc
or
  $ llvm-as < foo.ll | opt -lowerinvoke | llvm-dis
or
  $ llvm-gcc -O2 foo.c -c -o - -emit-llvm | opt -lowerinvoke | llc -o foo.s

depending on what you're doing.

Nick




More information about the llvm-dev mailing list