[LLVMdev] Writing LLVM front-end

Hayden Livingston halivingston at gmail.com
Wed Feb 18 10:52:57 PST 2015


Thanks, Reid.

When you say the frontend needs to know about how LLVM implements it, do
you mean, the Function* type in LLVM, and in which order you add to the
arguments array when building this type?

Thank you for the video link, just reading the abstract I see this is the
way to go. However, as I finished typing the sentence, I wonder if this
means clang and/or llvm may be a runtime dependency. I imagine it doesn't
need to be and that clang is the tool I'll use to link to the external
libraries without an FFI.


On Wed, Feb 18, 2015 at 10:38 AM, Reid Kleckner <rnk at google.com> wrote:

> On Wed, Feb 18, 2015 at 10:20 AM, Hayden Livingston <
> halivingston at gmail.com> wrote:
>
>> I'm also a beginner, so asking on this beginner thread -- is there
>> anything in addition to the C ABI that one needs to worry about? I imagine
>> a C ABI gives lots of free libraries to integrate into your language, etc.
>>
>
> Being able to match the local C ABI is generally good enough for most
> languages. It makes it easy to implement the language runtime in C, and let
> you build an FFI to external libraries.
>
> However, if you want to leverage libraries in another language like C++ or
> Obj-C, it may be worth doing more work to allow deeper interoperability, as
> is done in Swift for Obj-C. See the "Skip the FFI" dev meeting talk:
> http://llvm.org/devmtg/2014-10/#talk18
>
>
>> Also the C ABI change on platforms? I thought C Calling convention was
>> the same on all platforms.
>>
>
> It is definitely different. However, if you're just passing scalar values
> (ints, floats, and pointers), then LLVM will more or less abstract it all
> away for you. If you pass aggregates, the frontend needs to know the
> platform calling convention and how LLVM implements it.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150218/8f105945/attachment.html>


More information about the llvm-dev mailing list