[fpc-pascal] making FPC more code optimized

Jorge Aldo G. de F. Junior jagfj80 at gmail.com
Sun Apr 29 14:23:38 CEST 2012

What would be usefull is to move the loads of code stored in
sysutils/runtime into a dll/so.

thats what makes C code look "smaller", theres a nice libc (and
others) there that groups mostly used functions into a single
instance, while in pascal every executable replicates the very same
code for each instance.

make sysutils/runtime etc an external loadable library and we are
going to see FPC generate similar sized executables for similarly
sized programs.

2012/4/29 Jonas Maebe <jonas.maebe at elis.ugent.be>:
> 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.
> Jonas_______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

More information about the fpc-pascal mailing list