I kinda agree, but I'm too incompetent in the matter. :-)

However, I was simply asking if, on amd64, kencc uses the 6 registers that the abi deserves to the parameters.
As far as I've understood only BP is used (for the first argument, if integer).

Can you confirm?



Giacomo

2016-02-02 1:36 GMT+01:00 Charles Forsyth <charles.forsyth@gmail.com>:

On 1 February 2016 at 23:34, Giacomo Tesio <giacomo@tesio.it> wrote:

Is it correct to say that this means that the Plan9 compiler suite *never* follows the sysV calling convention documented at section 3.2.3 of AMD64 ABI http://www.x86-64.org/documentation/abi.pdf and always pushes parameters to the stack?

On amd64, the first parameter, if an integer, is passed in RARG, which is actually BP.
The RISC machines generally pass the first parameter, if an integer, in a register.

In general, the compiler suite never follows conventions prescribed by apparent maniacs.
In particular, varargs/stdargs should (in 2000, let alone 2016) be really easy: lay down the ... parameters on the stack as an array in memory.
Done. Instead ABIs give pages of filth that try to work out where things are for the va_x macro calls,
because the ABI insists on following the same calling convention
for vararg/stdarg functions as might be used for other functions with fixed parameters: parameter passing in registers, special rules for structs, special rules for structs that fit in the parameter registers, special rules for floating-point values. Absurd.