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

Sean Silva silvas at purdue.edu
Fri Nov 22 19:45:59 PST 2013


On Fri, Nov 22, 2013 at 10:25 PM, Mikael Lyngvig <mikael at lyngvig.org> wrote:

> Hi guys,
>
> 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.
>
> I write it for two reasons:
>
> 1. I need to know this stuff myself to be able to continue on my own
> language project.
> 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.
>

We get questions like "how do I implement a string type in llvm"
frequently, so something like this is probably useful.


>
> 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.
>
> 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.
>
> 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.
>

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.

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.

If you are implementing a language, a good topic for a document that you
can probably help with is the following:
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?

-- Sean Silva




>
>
> Cheers,
> Mikael
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131122/7cde3788/attachment.html>


More information about the llvm-dev mailing list