Thread overview
libfirm-d - D bindings of Firm, a compiler IR based on the SSA form
Jul 01, 2018
Basile B.
Jul 01, 2018
ketmar
Jul 01, 2018
Basile B.
Jul 02, 2018
ketmar
Jul 05, 2018
Basile B.
Jul 05, 2018
ketmar
Jul 05, 2018
Chris M.
Jul 05, 2018
Basile B.
Jul 05, 2018
Chris M.
Apr 29, 2019
Basile B.
July 01, 2018
I've recently ported libfirm to D.

This nice C library, developed at the Karlsruhe university, allows to build compiler back-ends, using the SSA intermediate representation.

In theory it could even be used to make a new D compiler version, e.g "FDC", although this is obviously of no interest ;)

So this is mostly to make JIT scripting engines or back-ends for toy languages...

See:

- https://github.com/BBasile/libfirm-d
- https://code.dlang.org/packages/firm-d
- https://pp.ipd.kit.edu/firm/

Note that unfortunately this library is LGPL2 licensed, so much less usable than LLVM-d, which is a similar but a more mainstream library.
July 01, 2018
Basile B. wrote:

> I've recently ported libfirm to D.

great news and great work, thank you. yet i must admit that wrapping != porting. for a moment you made my heart stopped, 'cause i thought that i wasted alot of time trying to do a proper port (nope, not finished, but still...).
July 01, 2018
On Sunday, 1 July 2018 at 15:03:30 UTC, ketmar wrote:
> Basile B. wrote:
>
>> I've recently ported libfirm to D.
>
> great news and great work, thank you. yet i must admit that wrapping != porting. for a moment you made my heart stopped, 'cause i thought that i wasted alot of time trying to do a proper port (nope, not finished, but still...).

Thanks. BTW I remember you said on IRC that SSA form is much better (maybe it was once when we talked about DMD optimizations or something like that)... this is basically why i choose this one, although not sure if i'll manage to do something with it.
July 02, 2018
Basile B. wrote:

> On Sunday, 1 July 2018 at 15:03:30 UTC, ketmar wrote:
>> Basile B. wrote:
>>
>>> I've recently ported libfirm to D.
>>
>> great news and great work, thank you. yet i must admit that wrapping != porting. for a moment you made my heart stopped, 'cause i thought that i wasted alot of time trying to do a proper port (nope, not finished, but still...).
>
> Thanks. BTW I remember you said on IRC that SSA form is much better (maybe it was once when we talked about DMD optimizations or something like that)... this is basically why i choose this one, although not sure if i'll manage to do something with it.

tbh, i gave up on porting it fully, so i prolly will go with your wrapper, if anything. and yeah, SSA rox. i am temporarily on C++ side now, yet sooner or later i'll return, and will have to restart Aliced again. maybe this time with a brand new backend. ;-)
July 05, 2018
On Sunday, 1 July 2018 at 12:04:06 UTC, Basile B. wrote:
> I've recently ported libfirm to D.
>
> This nice C library, developed at the Karlsruhe university, allows to build compiler back-ends, using the SSA intermediate representation.
>
> In theory it could even be used to make a new D compiler version, e.g "FDC", although this is obviously of no interest ;)
>
> So this is mostly to make JIT scripting engines or back-ends for toy languages...
>
> See:
>
> - https://github.com/BBasile/libfirm-d
> - https://code.dlang.org/packages/firm-d
> - https://pp.ipd.kit.edu/firm/
>
> Note that unfortunately this library is LGPL2 licensed, so much less usable than LLVM-d, which is a similar but a more mainstream library.

Very nice, I remember checking this one out a while back.

I don't see the files from the ADT module though, was there a reason they weren't included?

https://github.com/libfirm/libfirm/tree/master/include/libfirm/adt
July 05, 2018
On Thursday, 5 July 2018 at 00:00:07 UTC, Chris M. wrote:
> On Sunday, 1 July 2018 at 12:04:06 UTC, Basile B. wrote:
>> I've recently ported libfirm to D.
>>
>> This nice C library, developed at the Karlsruhe university, allows to build compiler back-ends, using the SSA intermediate representation.
>
> Very nice, I remember checking this one out a while back.
>
> I don't see the files from the ADT module though, was there a reason they weren't included?
>
> https://github.com/libfirm/libfirm/tree/master/include/libfirm/adt

Yes there's a reason that is that these files mostly contain data structures, they are not needed in D and i don't remember having seen them as parameter type during translation of the headers, (although it's been done semi manually, so i could have missed one).
July 05, 2018
On Sunday, 1 July 2018 at 15:03:30 UTC, ketmar wrote:
> Basile B. wrote:
>
>> I've recently ported libfirm to D.
>
> great news and great work, thank you. yet i must admit that wrapping != porting.

Right, i have used the wrong words. Title hopefully is not ambiguous.
July 05, 2018
Basile B. wrote:

> On Sunday, 1 July 2018 at 15:03:30 UTC, ketmar wrote:
>> Basile B. wrote:
>>
>>> I've recently ported libfirm to D.
>>
>> great news and great work, thank you. yet i must admit that wrapping != porting.
>
> Right, i have used the wrong words. Title hopefully is not ambiguous.

ah, tbh, i'm just being jealous. you did my work! me is useless now!
July 05, 2018
On Thursday, 5 July 2018 at 01:11:58 UTC, Basile B. wrote:
> On Thursday, 5 July 2018 at 00:00:07 UTC, Chris M. wrote:
>> On Sunday, 1 July 2018 at 12:04:06 UTC, Basile B. wrote:
>>> [...]
>>
>> Very nice, I remember checking this one out a while back.
>>
>> I don't see the files from the ADT module though, was there a reason they weren't included?
>>
>> https://github.com/libfirm/libfirm/tree/master/include/libfirm/adt
>
> Yes there's a reason that is that these files mostly contain data structures, they are not needed in D and i don't remember having seen them as parameter type during translation of the headers, (although it's been done semi manually, so i could have missed one).

Makes sense, I didn't think you would have just missed them.
April 29, 2019
On Sunday, 1 July 2018 at 12:04:06 UTC, Basile B. wrote:
> I've recently ported libfirm to D.
>
> This nice C library, developed at the Karlsruhe university, allows to build compiler back-ends, using the SSA intermediate representation.
>
> In theory it could even be used to make a new D compiler version, e.g "FDC", although this is obviously of no interest ;)
>
> So this is mostly to make JIT scripting engines or back-ends for toy languages...
>
> See:
>
> - https://github.com/BBasile/libfirm-d
> - https://code.dlang.org/packages/firm-d
> - https://pp.ipd.kit.edu/firm/
>
> Note that unfortunately this library is LGPL2 licensed, so much less usable than LLVM-d, which is a similar but a more mainstream library.

With the recent release of dstep 1.0.0 I've managed to make a new minor release that only auto generate the sources (v0.1.0). It was obviously not a good idea to maintain all the headers up to date manually, although this permitted to learn a bit the API.

Note that building must be done at least twice the first time because of a DUB limitation.

other changes :
- dub package on code dlang is gone, it must really be a git stuff now
- it's much faster because build is optimized using git hashes.
- location changed due to GH account renaming

https://github.com/Basile-z/libfirm-d