[LLVMdev] "Mapping High-Level Constructs to LLVM IR"

Joshua Cranmer pidgeot18 at gmail.com
Sat Nov 23 11:35:50 PST 2013


On 11/23/2013 12:18 AM, Mikael Lyngvig wrote:
> Thanks, you have a lot of valid points there.  I have myself long ago 
> abandoned the path of using C as a backend language due to the very 
> factors you mention.
>
> However, as I said, the document was put together in 30 minutes.  Not 
> exactly ready for prime time :-)
>
> I do agree that all of the things you mention should be described, 
> including Lambdas, closures, and generators, but I must admit up front 
> that I don't know how to implement half of them.  But I suppose I 
> could do a lot of research and perhaps occasionally ask you guys for 
> specifics.
>
> We are not going to find much common ground on the issue of "calling 
> propagated return values for exception handling", I think :-)  See 
> https://www.lyngvig.org/Teknik/A-Proposal-for-Exception-Handling-in-C 
> for the details.

That appears to be comparing return value propagation to setjmp/longjmp, 
which is not considered a good exception handling model. Most low-cost 
(or no-cost!) exception handling mechanisms are based on an unwind 
approach, where a thrown exception causes the stack trace to be 
inspected to find the appropriate catch block. If exceptions are not 
thrown, there is no execution cost to setting up a try/catch block, 
although this is paid for by a relatively expensive throw 
implementation. Details of such an implementation can be found in the 
Itanium ABI <http://mentorembedded.github.io/cxx-abi/abi-eh.html> 
(which, despite its name, is the ABI used by gcc and clang).

-- 
Joshua Cranmer
News submodule owner
DXR coauthor




More information about the llvm-dev mailing list