[fpc-devel] The 15k bounty: Optimizing executable speed for Linux x86 / LLVM

Ben Grasset operator97 at gmail.com
Sat Oct 27 18:21:44 CEST 2018


On Sat, Oct 27, 2018 at 8:47 AM Jonas Maebe <jonas at freepascal.org> wrote:

> On 27/10/18 05:45, Ben Grasset wrote:



> You also need "opt" if you want to perform full optimizations (or just
> use clang, which a.o. combines the functionality of llc and opt).
>
> There's one more problem I forgot to mention in my first post, and it is
> probably a deal breaker for the original bounty: LLVM does not support
> Borland's fastcall calling convention for i386. So you would need to add
> support for Borland fastcall on i386 to LLVM if it has to support
> existing i386 inline assembly routines written for FPC/Delphi.
>
> Finally, adding support for 32 bit targets in FPC's LLVM backend would
> also require some work due to how FPC's code generator is structured,
> and due to the fact that need to have two code generators in a single
> binary (the native one to support the generation of entry and exit code
> for pure inline assembler routines, and the LLVM one for the rest).
>

LLC (at least now) statically links the necessary parts of LLVM and works
independently of Opt, with a simpler set of command line options (it just
has overall O1, O2, and O3 flags.)

As far as the point about assembly on 32 bit, while it does seem like that
would be a problem for the bounty requirements, would it really be the end
of the world in a more general sense? I can't imagine people who are still
using 32-bit-hardware and writing 32-bit applications would complain if the
LLVM backend was not available for 32-bit.

Anyways though, I do think code gen improvements for FPC, LLVM or not, are
likely going to be a lot more widely helpful than just rewriting exception
handling.... (not that rewriting exception handling is a bad idea.) I think
there's a lot of people who would like FPC to generate faster code than it
currently does. Can you recommend any known areas in need of improvement of
the non-platform-specific parts of the code generators that might be a good
place to start for someone who's an experienced Pascal developer but hasn't
worked with the compiler codebase before?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20181027/e439daef/attachment.html>


More information about the fpc-devel mailing list