[fpc-devel] Enable LLVM?

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Jul 30 18:58:05 CEST 2015

On 14/07/15 10:13, Jonas Maebe wrote:
> No, just the svn commit log. The status right now is that the system
> unit for Darwin/x86-64 can be mostly compiled and "assembled" (i.e., the
> generated LLVM IR can be successfully parsed by llc -- although since it
> doesn't get completely to the end, I may not have seen all errors for
> code coming before that yet) other than
> a) RTTI

This has now been implemented as well. With some local hacks and a few
manual changes to the generated code, the system unit for Darwin/x86-64
can now be compiled and successfully assembled. Note that this is with
all inline assembly code removed (and pure inline assembly functions
just returning 0 or its equivalent, so a lot of code is wrongly
optimised away by llvm based on that).

Some results are interesting, like the lowercase(shortstring) function
becoming a rather impressive vectorised jungle:
http://pastebin.com/vpugp80e . The only other vectorised functions in
the system unit are lowercase(shortstring),
UCS4StringToUnicodeString/Widestring, ArrayStringToPPChar and the
helpers to add/sub/mul/symdif large sets.

On the other hand, it seems that loading an array as a plain value in
llvm bitcode results in rather suboptimal code (this is with -O2):
http://pastebin.com/krXhuEzF :)


More information about the fpc-devel mailing list