Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2025-06

fpc_ compilerproc

4 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mattias Gaertner

Hi,

How do the fpc_ compileprocs in the rtl like fpc_abs_real work?

Some platforms have assembler code, others just raises an error.

They are included by a comment:

{ documenting compiler proc. is useless, they shouldn't be used by the
user anyways }
{$ifndef fpdocsystem}
{$i compproc.inc}

They are included if fpdocsystem is *not* defined, but the comment says they are for documentation only. Confusing.

Mattias

Reply by email

J. Gareth Moreton
to Mattias Gaertner

If I'm right in thinking, things like "fpc_abs_real" are fallback functions that have to be overridden by a platform-specific implementation, and return runtime errors if they aren't implemented.  In many cases, such internal compiler routines are not called at all because there's a direct instruction available in the architecture (e.g. for integer min and max functions, AArch64 has SMIN and SMAX respectively, but x86 doesn't have such direct operations).

I may have gotten a few details wrong - it's been a while since I worked on the RTL (last time was to implement a more optimised exponential function, and to be cleverer with optimising min/max functions).

Kit

Mattias Gaertner wrote 24 lines
Hi, How do the fpc_ compileprocs in the rtl like fpc_abs_real work? Some platforms have assembler code, others just raises an error. They are included by a comment: { documenting compiler proc. is useless, they shouldn't be used by the user anyways } {$ifndef fpdocsystem} {$i compproc.inc} They are included if fpdocsystem is *not* defined, but the comment says they are for documentation only. Confusing. Mattias _______________________________________________ fpc-devel maillist  -  https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
This email has been checked for viruses by Avast antivirus software. www.avast.com

Reply by email

Mattias Gaertner
to J. Gareth Moreton
J. Gareth Moreton wrote 7 lines
If I'm right in thinking, things like "fpc_abs_real" are fallback functions that have to be overridden by a platform-specific implementation, and return runtime errors if they aren't implemented. In many cases, such internal compiler routines are not called at all because there's a direct instruction available in the architecture (e.g. for integer min and max functions, AArch64 has SMIN and SMAX respectively, but x86 doesn't have such direct operations).

Thanks.

Btw, the "compilerproc" modifier is still not documented. Google found my post from 8 years ago asking a similar question. 🙃

Maybe add a sentence: A compilerproc's symbol gets hidden at the Pascal level and can't be called manually.

Mattias

Reply by email

Michael Van Canneyt
to Mattias Gaertner
Mattias Gaertner wrote 15 lines
On 6/25/25 08:42, J. Gareth Moreton via fpc-devel wrote: > If I'm right in thinking, things like "fpc_abs_real" are fallback > functions that have to be overridden by a platform-specific > implementation, and return runtime errors if they aren't implemented. In > many cases, such internal compiler routines are not called at all > because there's a direct instruction available in the architecture (e.g. > for integer min and max functions, AArch64 has SMIN and SMAX > respectively, but x86 doesn't have such direct operations). Thanks. Btw, the "compilerproc" modifier is still not documented. Google found my post from 8 years ago asking a similar question. 🙃

I documented it.

Michael.

Reply by email