[fpc-pascal] making FPC more code optimized

Jonas Maebe jonas.maebe at elis.ugent.be
Sun Apr 29 12:44:30 CEST 2012

On 29 Apr 2012, at 12:22, Florian Klämpfl wrote:

> Spent more man power into optimizer development, though some
> optimizations are hard in pascal because we assume stricter aliasing
> rules and because we don't have a volatile keyword.

At least as far as our current optimizers are concerned, nothing is volatile in Pascal: both the assembler and node tree optimizers will replace multiple loads of global data with a single load when they can. So that should not limit any optimizations at this time.

Regarding aliasing, I'm not sure whether C defines anything regarding that. You at least need to use the -fstrict-aliasing gcc flag to tell it to assume that pointers to different types cannot alias each other (and hence get better optimizations). In standard Pascal, pointers by definition can only point to data of one particular type, so it could be compiled with -fstrict-aliasing in any case. Since in FPC/Delphi this is no longer the case, you could introduce a similar switch there to allow programmers to tell the compiler that their code also obeys strict aliasing rules.

In general, I think it's indeed simply a matter of the amount of man power spent on optimizations.


More information about the fpc-pascal mailing list