[fpc-pascal] inlining functions

denisgolovan denisgolovan at yandex.ru
Sat Jan 12 14:14:47 CET 2019

12.01.2019, 15:32, "Jonas Maebe" <jonas at freepascal.org>:
> It's not yet integrated in the compiler, so you have to do it manually
> right now:
> a) compile everything with -al (including the RTL etc; add OPT="-a" to
> the make command)
> b) go in all the unit directories, and assemble the files to bitcode
> using something like this:
> for file in *.ll; do
>    clang -emit-llvm -O -c $file
> done
> c) compile your program with -a -s and do the same as in step b) for
> your program
> d) edit the generated link.res file, and replace all references to unit
> files ending in ".o" with the same files ending in ".bc"
> If you used a custom clang rather than the one installed by default on
> your system, you will also have to specify the path to the libLTO that
> the linker should use. You have to do this on the ld command line in
> ppas.sh. You can find the correct parameter by compiling a test
> C-program with "clang -flto -### test.c", as this will print the ld
> invocation to use. E.g. on macOS, it will be something like
> -lto_library
> /Volumes/imac/devel/clang+llvm-7.0.0-x86_64-apple-darwin/lib/libLTO.dylib"
> On Linux, it's something like
> -plugin
> /home/jmaebe/local/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/../lib/LLVMgold.so
> -plugin-opt=O2
> (or a different optimization level)

Thanks, but I expected something like rebuilding compiler and adding some option to Lazarus project :)
So far it looks like it's not far away from manually recompilation of each and every module.

Denis Golovan

More information about the fpc-pascal mailing list