Am 16.02.20 um 22:28 schrieb Anton Shepelev via fpc-pascal:

But which registers shall be preserved by inline proceudres
and functions?

IIRC (it is 25 years ago :)): sp and bp

 In this example from the manual, the SP
register is not preserved within the statement:

It is reset to it's value before the parameters were pushed.


     function LongMul(X, Y: Integer): Longint;
     inline (
     $5A/        {POP  AX}
     $58/        {POP  DX}
     $F7/$EA);   {IMUL DX}

Does it mean it shall reset SP to a position before the
parameters?

Yes. TP calling conventions means the callee (in this case the inline code) clears the stack (remove parameters).

What about the other registers -- does Turbo
Pascal take care of them, perhaps enveloping each expansion
of an inline procedure into a POPs and PUSHes?


No.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to