Plan to Update GPC

Jonas Maebe jonas at freepascal.org
Wed Jun 3 20:14:08 CEST 2020


On 03/06/2020 16:40, Waldek Hebisch wrote:

> On Wed, Jun 03, 2020 at 09:03:44AM -0400, Kevan Hashemi wrote:
>> (8) According to comments in the GPC source files, one of the reasons the GCC team goes ahead and breaks other people's front ends is because they are implementing new optimisation routines. So, we would expect the GCC code to be fast, even if GCC itself is a pain in the neck. But my FPC code runs approximately twice as fast as my GCC code. I tested it inverting 100 x 100 matrices on a Linux machine where I have both GPC and FPC running in 64-bit.
> 
> Could you post your benchmark.  To say the truth I spent some time
> looking at assembly code produced by GPC and cases when it was possible
> to gain significant speedup at assembly level were quite rare.

My guess is the difference may be due to moving to i386 (32 bit) to
x86-64 (64 bit). SSE is quite a bit faster than the x87 fpu. While FPC's
code generation is definitely not bad, it does lack many transformations
that GCC (and LLVM) have. Especially when it comes to loop transforms.
On the other hand, perhaps GCC 4.x did not have too many of those yet
either.

> Well, Aplle decided to use LLVM mostly for licencing reasons: they want
> to control software on iPhones (so that it is Apple who controls
> what gets installed on users iPhone), and GPL 3 (used for GCC 4.2 and
> higher) requires that users have ability to install their own programs.

Since Apple doesn't ship a compiler installed on iOS devices (although
perhaps nowadays they kind of do, with Swift Playgrounds), I don't think
that would have caused problems. But you're absolutely right a main
reason was that they loathe the GPLv3.

> BTW.  My student made a small compiler interfacing LLVM (he did not
> want to deal with GCC).  In about 2 years his compiler got completely
> broken by changes to LLVM interface...

Yes, LLVM breaks a lot of middle-end code all of the time as well.
Fortunately, their bitcode format is fairly stable (even the text
version of it, in spite of them not guarantee any compatibility there at
all), so that's what I'm using for FPC's (optional) LLVM code generator
backend.


Jonas



More information about the Gpc mailing list