<div dir="ltr">Yes, it is sort of scary that there seems to be no definite resource to consult for information on especially advanced OOP things. I have something like 20 compiler books on my shelves and yet none of them mention a single word on how to implement multiple inheritance, exception handling, or interfaces. It seems like they are all happy about presenting a subset of Pascal, or Java, with an integer and boolean type, and then let the reader figure out all the hard stuff by himself or herself. I know I picked most of my knowledge up from doing lots of debug info converters back when C++ was just coming to market - the early C-only debuggers didn't understand C++ so the quick solution was to convert C++ debug info into lowered C debug info :-) If you know of any compiler book that covers advanced OOP topics, please feel free to let me know the title/ISBN of it.<div>
<br></div><div>I was thinking of making a tutorial sometime down the road when I have myself grasped sufficient about LLVM. For the time being, I think it makes a lot of sense to first transform into C (a language known by most) and then take it one level further by transforming into LLVM IR. I cannot promise that I will make such a tutorial, but the outcome of this sub-project should definitely make it much easier to make such a tutorial. Personally, I think the lowering into C makes the difficult topics very easy to understand: Once you've understood how to lower a C++ class into a C structure with associated functions, almost all of the magic of the C++ class vanishes and you're set to go.</div>
<div><br></div><div><div>I envision LLVM as a sort of "compiler builders' power toolbox" and along with that vision goes a lot of great documentation that makes you fly in no time. To be honest, I personally feel that the learning curve is a bit steep. From building using a non-Microsoft compiler (on Windows) over to making a buildbot slave over to implementing an actual language using LLVM, I think the path is rather difficult. It may just be me, or it may also be that you LLVM gurus have breathed LLVM for so long that you no longer remember that not everybody getting in touch with LLVM actually wants to code on LLVM.</div>
<div><br></div></div><div>I'll add a section on "How to Interface to the Operating System" to the article. I'll focus on interfacing directly with the host operating system as I personally dislike the C run-time library for a lot of reasons (ever met a programmer who routinely checked errno? - I haven't, although I have once or twice in my life seen Unix code that actually did bother to check errno).<br>
</div><div><br></div><div>Perhaps it is better if I already now plan to release this article on my own web site? I don't want to impose it on you guys, but I definitely want to do it. I know there are more than 5.000 programming languages in the world and if only half the developers were to adopt LLVM, things would surely look much brighter with respect to the number of contributors of builders, documentation, and actual code patches.</div>
<div><br></div><div><br></div><div>-- Mikael</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/11/23 Sean Silva <span dir="ltr"><<a href="mailto:silvas@purdue.edu" target="_blank">silvas@purdue.edu</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Nov 22, 2013 at 10:25 PM, Mikael Lyngvig <span dir="ltr"><<a href="mailto:mikael@lyngvig.org" target="_blank">mikael@lyngvig.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi guys,<div><br></div><div>I have begun writing on a new document, named "Mapping High-Level Constructs to LLVM IR", in which I hope to eventually explain how to map pretty much every contemporary high-level imperative and/or OOP language construct to LLVM IR.</div>
<div><br></div><div>I write it for two reasons:</div><div><br></div><div>1. I need to know this stuff myself to be able to continue on my own language project.<br></div><div>2. I feel that this needs to be documented once and for all, to save tons of time for everybody out there, especially for the language inventors who just want to use LLVM as a backend.</div>
</div></blockquote><div><br></div><div>We get questions like "how do I implement a string type in llvm" frequently, so something like this is probably useful.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div><br></div><div>So my plan is to write this document and continue to revise and enhance it as I understand more and helpful people on the list and elsewhere explain to me how these things are done. </div><div><br></div>
<div>Basically, I just want to know if there is any interest in such a document or if I should put it on my own website. If you know of any books or articles that already do this, then please let me know about them.</div>
<div><br></div><div>I've attached the result of 30 minutes work, just so that you can see what I mean. Please don't review the document as it is still in its very early infancy.<br></div></div></blockquote><div>
<br></div><div>I feel like the "lowering it to C" part is part of the typical "low level curriculum" that is unfortunately not taught anywhere really, but I feel is common knowledge among ... I'm not sure who, but I'm pretty sure that almost all LLVM developers picked it up somehow, somewhere (I honestly don't know where I did...). I would try to investigate if there is an alternative place where these things are discussed better, since I feel like this is not very LLVM-specific knowledge.</div>
<div><br></div><div>For covering this sort of thing inside the LLVM docs, the best way I can think to do so is to improve docs/tutorial/ to just add those features.</div><div><br></div><div>If you are implementing a language, a good topic for a document that you can probably help with is the following:</div>
<div>LLVM doesn't provide a "complete portable runtime environment"; you still need to know how to e.g. get access to malloc, or link with system libraries for basic functionality, etc. What sorts of "glue" work like the above does a language implementor typically have to do in order to make a runnable language?</div>
<div><br></div><div>-- Sean Silva </div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div></div><div><br></div>
<div><br></div>
<div>Cheers,</div><div>Mikael</div></div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">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></div>
</blockquote></div><br></div>