#### View Issue Details

ID Project Category View Status Date Submitted Last Update 0037266 FPC Documentation public 2020-06-26 11:47 2020-06-28 15:14 Kai Burghardt Michael Van Canneyt normal minor always assigned open x86_64 GNU/Linux 3.0.4 0037266: Reference Guide erroneously claims EAX, ECX, EDX were used for the first three parameters in register calling convention It should be EDI, ESI, EDX instead. Just delete the claim. No tags attached. Attached Files

#### Activities

 2020-06-26 11:47 reporter ref.tex.patch (648 bytes)    --- ref.tex~ 2020-06-26 09:45:00.171076316 +0000 +++ ref.tex 2020-06-26 09:45:00.171076316 +0000 @@ -11527,8 +11527,7 @@ \label{se:register}\index{register}\index{Modifiers!register}\keywordlink{register} The \var{register} keyword is used for compatibility with Delphi. In version 1.0.x of the compiler, this directive has no effect on the -generated code. As of the 1.9.X versions, this directive is supported. The -first three arguments are passed in registers EAX, ECX and EDX. +generated code. As of the 1.9.X versions, this directive is supported. \subsection{safecall} \index{safecall}\index{Modifiers!safecall}\keywordlink{savecall}  ref.tex.patch (648 bytes) 2020-06-26 13:11 reporter   ~0123599 Last edited: 2020-06-26 21:10View 3 revisions The claim is (almost) correct for x86-32-bit: register calling convention uses EAX EDX ECX as first 3 parameters, in that order. For 64-bit [as you've tagged your report x86_64 GNU/Linux] RDI, RSI et al are used, NOT EDI ESI etc, 2020-06-26 16:32 manager   ~0123601 > For 64-bit RDI, RSI et al are used, NOT EDI ESI etc, For x86_64 the "register" calling convention does not exist as a separate calling convention instead the platform's default calling convention is used (Win64 vs. non-Win64). On non-Win64 it is indeed RDI and RSI that are used (amongst others), but for Win64 it would RCX, RDX, R8 and R9. @Michael: it might be best to document that the "register" calling convention as such exists only on specific platforms (currently i386 and m68k) otherwise the default will be used. 2020-06-27 09:02 reporter   ~0123610 OK, thanks for the clarification. I’d still delete the claim though, in the spirit of 0035867:0117336 “It does not make sense to reproduce the ABIs of every supported platform in our own documentation.” 2020-06-27 10:30 manager   ~0123611 Last edited: 2020-06-27 10:31View 2 revisions For the register calling convention it does make sense though, because it is not part of the platform ABI and in those cases where it doesn't match the platform ABI (namely i386, i8086 and m68k) the users should know which registers to use for assembly routines. 2020-06-27 12:32 reporter   ~0123614 I understand that this will require further development in the future, but it might be better to specify a table where for each platform to specify which registers are used? 2020-06-28 15:14 reporter   ~0123648 OK, but then please move it to the “Programmer’s guide.“ The “Reference guide” is, as far as I understand, about the Language, while the Programmer’s guide explains issues concerning this particular compiler, FPC. (In § “Calling mechanism” (of the Programmer’s guide) there is already a statement, quote, “The list of registers that are modified is highly dependent on the processor, calling convention and ABI of the target platform.”)