[fpc-devel] LLVM Backend?

Matej Spiller-Muys matej.spiller at gmail.com
Mon Nov 16 18:48:39 CET 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.

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)
Simple tutorial for new language:
http://llvm.org/docs/tutorial/LangImpl1.html.

I believe FPC should be first similarly divided into separate blocks (Lexer,
Parser, AST, Codegen). It is already, just perhaps more interface based
approach (or more like fpcdoc parser is).

After that people could create even backends for .NET (like Delphi does) and
even perhaps Java or XML code dumps (like it was suggested some time ago on
this mailing list by someone else).

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.

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

Matej Spiller-Muys

On Mon, Nov 16, 2009 at 4:49 PM, Samuel Crow <samuraileumas at yahoo.com>wrote:

>
>
> > > There are classes to create any type documented at
> > http://llvm.org/docs/ProgrammersManual.html#Type .  As of the current
> 2.6
> > release there are now more extensive C bindings included with LLVM than
> were
> > previously available.  Once I get the trunk downloaded I'll see about a
> link to
> > the actual documentation on how to use those C bindings.
> >
> > Ok.
>
> It looks like the in-code documentation in llvm/includes/llvm-c/Core.h
> contains all of the documentation about using IRBuilder plus wrapping and
> unwrapping macros for type conversions using the C wrappers.  There are
> other abstract datatype class templates that aren't included in the C
> wrappers but we'd need to write separate C wrappers for each use of them
> anyway.  Let me know if there's anything I can find out for you.
>
> --Sam Crow
>
>
>
>
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20091116/ccf95f91/attachment.html>


More information about the fpc-devel mailing list