[fpc-devel] LLVM Backend?

Jonas Maebe jonas.maebe at elis.ugent.be
Mon Nov 16 20:31:35 CET 2009


Matej Spiller-Muys wrote on Mon, 16 Nov 2009:

> I would love fpc to be based on LLVM backend. C bindings are ok, but
> wouldn't it be better to fix support for cppclass inside fpc (since it is
> already there) and create more proper C++ headers.

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.

> I have studied clang project a bit (as C/C++ frontend for LLVM) and it
> actually makes more sense to me that FPC compiler even though pascal is
> generally more readable as a language.
> CLang SVN: http://llvm.org/svn/llvm-project/cfe/trunk/lib/ (and compare that
> to FPC compiler source)

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.

> Another thing is, that I would prefer LLVM backend to be more C++ API
> compatible than FPC/Delphi even if we loose some FPC features (like RTTI),
> pascal calling conventions.

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.

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.

> Basically I don't think FPC should just go into LLVM direction, but should
> support LLVM efforts to create more pluggable backends.

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.


Jonas

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.




More information about the fpc-devel mailing list