<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Hi Eli,</div><div><br></div><div>You pretty much have it right already, honestly.</div><div><br></div>builtin setjmp and longjmp are for Darwin SjLj exception handling on ARM. That’s the llvm.eh.sjlj.* intrinsics.<div><br></div><div><div><div><div>On May 8, 2013, at 2:25 PM, Eli Bendersky <<a href="mailto:eliben@google.com">eliben@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir="ltr"><div>I'm trying to make sense in the support for setjmp/longjmp in Clang and LLVM, with only partial success. I'll try to summarize my findings in the hope that someone can shed some light on why things are the way they are and what I'm missing.<br></div><div><br></div><div>Clang.</div><div><br></div><div>Clang recognizes two forms of setjmp (all I say here applies to longjmp similarly):</div><div>* __builtin_setjmp: gets lowered to calling the llvm.sjlj.setjmp intrinsic</div><div>* setjmp() library call does not appear to be handled specially, although a no-longer-comment in a test I removed in r181468 said: </div><div><br></div><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">"__builtin_longjmp/setjmp should get transformed into llvm.setjmp/longjmp <br> just like explicit setjmp/longjmp calls are."</blockquote></blockquote><div><div><br></div><div>On my Ubuntu machine, the call actually gets transcibed to calling _setjmp, but that may be due to compiler settings in system library headers.</div><div><br></div><div>LLVM.</div><div><br></div><div>LLVM supports two flavors of setjmp/longjmp intrinsics: llvm.{set|long}jmp and llvm.eh.sjlj.{set|long}jmp</div><div>The latter is documented in <a href="http://llvm.org/docs/ExceptionHandling.html">http://llvm.org/docs/ExceptionHandling.html</a><span class="Apple-converted-space"> </span>and has some tests for it. The former is not documented anywhere and has no tests. The former is handled by lowering the intrinsic call to calling the actual library function in SelectionDAGBuilder.cpp</div><div><br></div><div>--------------</div><div><br></div><div>My questions are:</div><div>* First of all, is this a correct summary?</div></div></div></div></blockquote><div><br></div><div>Sounds right, yeah.</div><br><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir="ltr"><div><div>* Why the (defunct) comment in a Clang test? Was clang lowering setjmp library calls to intrinsics at some point?</div></div></div></div></blockquote><div><br></div><div>Not sure. It probably just got missed during a cleanup/refactoring at some point.</div><br><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir="ltr"><div><div>* Are the llvm.setjmp and llvm.longjmp intrinsics still officially supported? Being absent in the language reference and especially tests can lead one to believe they are deprecated.</div></div></div></div></blockquote><div><br></div><div>If they’re not deprecated, they probably should be.</div><div><br></div><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir="ltr"><div><div>Thanks in advance,</div><div>Eli</div><div><br></div><div><br></div><div><br></div></div></div>_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a><span class="Apple-converted-space"> </span>        <a href="http://llvm.cs.uiuc.edu/">http://llvm.cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a></div></blockquote></div><br></div></div></body></html>