LDC2 win64 calling convention
kinke
noone at nowhere.com
Wed Nov 28 20:17:53 UTC 2018
On Wednesday, 28 November 2018 at 18:56:14 UTC, realhet wrote:
> 1. Is there register parameters? (I think no)
Of course, e.g., POD structs of power-of-2 sizes <= 8 bytes and
integral scalars as well as float/double/vectors. The stack isn't
used at all, aggregates > 8 bytes are passed by ref (caller makes
a copy on its stack and passes a pointer to it to the callee);
that seems not to be mentioned at all in the Wiki article.
> 2. What are the volatile regs? RAX, RCX, RDX, XMM6..XMM15?
See Microsoft's docs.
> 3. Is the stack pointer aligned to 16?
It is IIRC.
> 4. Is there a 32 byte shadow area on the stack?
Yes, IIRC.
---
LDC conforms to the regular Win64 ABI (incl. __vectorcall
extension for vectors). The biggest difference is that
`extern(D)` (as opposed to `extern(C)` or `extern(C++)`) reverses
the arguments - `foo(1, 2, 3, 4)` becomes `foo(4, 3, 2, 1)`, so
not the first 4 args are passed in registers if possible, but the
last ones (incl. special cases wrt. struct-return + `this`
pointers). Other than that, there are just very few special cases
for delegates and dynamic arrays, which only apply to `extern(D)`.
More information about the Digitalmars-d-learn
mailing list