[fpc-devel] LLVM Backend?

Matej Spiller-Muys matej.spiller at gmail.com
Mon Nov 16 22:01:53 CET 2009


> C interfacing works today and has been very thoroughly tested. cppclass
only works, for very basic things, since 2 days ago or so. Unless someone
enjoys
> debugging a new code generator and a new external language interfacing
paradigm at the same time, that does not sound like a very good idea to me.
Absolutely you have a point here. But AFAIK "C++ linking" is part of FPC
roadmap (not part of LLVM discussion at all). And LLVM C++ support is at
least currently more feature complete. Finish porting LLVM to C or
supporting C++. The question is what is more maintainable in the end?

> It doesn't weigh up to over 12 years of experience developing FPC and
knowing Object Pascal (to the extent that it's used in the compiler) inside
out.
> My C++ and STL knowledge is basic at best. If someone else wants to create
an FPC frontend for LLVM in C++, they are of course free to do so.
Exactly, I prefer frontend in FPC too, reusing lexer, parser, AST. Using
LLVM only as a compiled library for codegen (with C or C++ bindings).

> Then you're no longer talking about porting FPC/Delphi, but about creating
a new language inspired by FPC/Delphi. There's nothing wrong with that,
> but given the amount of bug reports that we already get today when
implementation details are slightly different to Delphi's, I'm not sure how
much
> success you'd have with the existing Delphi/FPC users.
Actually I am. I was talking about C++ ABI ( not API, that was typo :) ).
Having class VMT, exceptions the same as C++ could be a huge interop benefit
:) And you get the C++ linking for free. Currently LLVM is still quite
evolving. And it would be easier to start with code based on CLang (with
some FPC features missing) and later add more FPC features when other
projects "invent" features that C++ does not have (VMKit & Reflection,RTTI).
It should be the faster way to implement LLVM frontend. With currently
implemented clang we could already support 90% of FPC language.

> You have to offer a basic "amount" of either compatibility or incredible
advantages before anyone will want to use your compiler. As soon as the
hurdle gets too
> high, many people will simply not consider it worth it and stick to what
they know. The threshold is different for different people, but it's not
that high in general.
True. And supporting LLVM does indeed offer a lot of incredible advantages
(well not all of them right away).

> FPC's backend is already quite plugable (otherwise we would not be able to
have 6 codegenerators maintained by 3-4 people).
> It's just at a lower level currently than what something like LLVM
requires.
That's what I meant. Abstraction on higher level.

>
http://www.linux-kongress.org/2009/slides/compiler_survey_felix_von_leitner.pdf
Btw how does FPC or Delphi fare in comparison to LLVM, GCC, VC++?

Matej Spiller-Muys
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20091116/6edb2fb4/attachment.html>


More information about the fpc-devel mailing list