<HTML><HEAD><TITLE>Samsung Enterprise Portal mySingle</TITLE>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
<STYLE id=mysingle_style type=text/css>P {
        MARGIN-TOP: 5px; FONT-FAMILY: Arial, arial; MARGIN-BOTTOM: 5px; FONT-SIZE: 9pt
}
TD {
        MARGIN-TOP: 5px; FONT-FAMILY: Arial, arial; MARGIN-BOTTOM: 5px; FONT-SIZE: 9pt
}
LI {
        MARGIN-TOP: 5px; FONT-FAMILY: Arial, arial; MARGIN-BOTTOM: 5px; FONT-SIZE: 9pt
}
BODY {
        LINE-HEIGHT: 1.4; MARGIN: 10px; FONT-FAMILY: Arial, arial; FONT-SIZE: 9pt
}
</STYLE>

<META name=GENERATOR content=ActiveSquare></HEAD>
<BODY>
<P>Sharing what I had seen while debugging some ARM exception handling issue for arm-gnueabi, partially answering the question.</P>
<P>"But what I didn't see is any DWARF data tables or SJLJ pushing/popping" this is not seen at IR. code generator might push this job to assembler by populating some exception table entries in asm. ARMException.cpp, DwarfException.cpp will help in finding for who generates this exception entry table in asm format. assembler understands this table format and produces required tables.</P>
<P> </P>
<P>------- <B>Original Message</B> -------</P>
<P><B>Sender</B> : Mikael Lyngvig<mikael@lyngvig.org></P>
<P><B>Date</B> : Dec 23, 2013 17:32 (GMT+05:30)</P>
<P><B>Title</B> : Re: [LLVMdev] EH intrinsics- numerous questions</P>
<P> </P>
<DIV dir=ltr>I don't know if you are familiar with the D language, but it also supports exceptions and has an LLVM frontend.  It can be found at <A href="https://github.com/ldc-developers/ldc">https://github.com/ldc-developers/ldc</A>. 
<DIV><BR></DIV>
<DIV><BR></DIV>
<DIV>-- Mikael</DIV></DIV>
<DIV class=gmail_extra><BR><BR>
<DIV class=gmail_quote>2013/12/23 DeadMG <SPAN dir=ltr><<A href="mailto:wolfeinstein@gmail.com" target=_blank>wolfeinstein@gmail.com</A>></SPAN><BR>
<BLOCKQUOTE style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class=gmail_quote>
<DIV dir=ltr>Hello all, 
<DIV><BR></DIV>
<DIV>I have a number of questions about the correct usage of the LLVM IR exception handling intrinsics. I am implementing a language of my own and have come to consider implementing exceptions and exception handling.</DIV>
<DIV><BR></DIV>
<DIV>I looked at the IR generated by Clang for some simple functions. I saw calls to, for example, __cxa_throw. But what I didn't see is any DWARF data tables or SJLJ pushing/popping. I know that for some targets, including the one that I use most, which is mingw32, there are multiple possible implementations (DWARF and SEH). So how can the code generator know how to implement the intrinsics like landing pad?</DIV>
<DIV><BR></DIV>
<DIV>Furthermore, even if there is some option in the LLVM API which I did not see, which specifies which option to use, then why are some other parts of the EH API so low-level? If the backend can determine that I intended Itanium ABI DWARF exception handling, then it should also know how to implement throw and catch based on that spec. It therefore seems unnecessary that other parts of the API involve digging around in exception tables.</DIV>
<DIV><BR></DIV>
<DIV>The documentation also raises further questions about other EH implementations. Only Itanium ABI and SJLJ are referenced. I'm pretty sure that SEH is a derivative of SJLJ, but what about the other EH handling mechanisms, like Windows x64?</DIV>
<DIV><BR></DIV>
<DIV>There are also intrinsics for values that make no sense. A prime example is the "selector" value, returned by typeid.for. The Itanium ABI makes absolutely no reference to a selector value of any kind. The documentation says that it returns an index into the exception table. How does it behave if SJLJ EH was chosen? What use would that even be, anyway? It is said that it is to be compared against the result of the landingpad instruction, but there's nothing saying what the landingpad returns or what the results would mean. This is further compounded by the fact that it's at least implied that the landingpad can actually return virtually any type. How could you compare an i32 against a landingpad that returns a pointer to a pointer to a std::string? What even are the valid return types of a landingpad instruction?</DIV>
<DIV><BR></DIV>
<DIV>The EH intrinsics specify that some parts of the Itanium ABI handling involve calling functions like __cxa_begin_catch. But how should these functions be implemented? The SJLJ documentation is even more vague- no API is even suggested.</DIV>
<DIV><BR></DIV>
<DIV>I have searched for examples for implementing EH on top of LLVM, and virtually the only one available is Clang. This is not terribly helpful since you'd inherently expect Clang to be coupled to the various C++ implementations used and it's not like a C++ implementation is going to be able to take the simple approach.</DIV>
<DIV><BR></DIV>
<DIV>I guess what I'm saying here is, how on earth do you put these pieces together and actually throw or catch an exception?</DIV></DIV><BR>_______________________________________________<BR>LLVM Developers mailing list<BR><A href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</A>         <A href="http://llvm.cs.uiuc.edu/" target=_blank>http://llvm.cs.uiuc.edu</A><BR><A href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target=_blank>http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</A><BR><BR></BLOCKQUOTE></DIV><BR></DIV>
<P> </P>
<P> </P><!--SP:senthil.t-->
<P>Regards</P>
<P>Senthil Kumar</P>
<P> </P><!--senthil.t:EP-->
<P> </P>
<TABLE id=confidentialsignimg>
<TBODY>
<TR>
<TD NAMO_LOCK>
<P><IMG border=0 src="cid:LP7KBSL8PYMC@namo.co.kr" width=520></P></TD></TR></TBODY></TABLE></BODY></HTML><img src='http://ext.samsung.net/mailcheck/SeenTimeChecker?do=5874e7b1b0875fb64b67063de8be15859300d6731521cf571e378f9370afbcb4fb398c26d37026371d70666c366810d91b20909a04efd4d2748cfe1d4e847419cf878f9a26ce15a0' border=0 width=0 height=0 style='display:none'>