atgreen/libffi — pull request #132 by nielsAD (2014-08-25 17:21:51+00:00)
Title: Pascal and Register calling convention support on x86

Register is the default calling convention for Delphi and FreePascal. It is a variant of fastcall, with parameters being passed via EAX, EDX, ECX and the stack (LTR). The pascal calling convention is similar to stdcall, but the order of parameters is LTR instead of RTL. I added support for both.

I also fixed the closures for thiscall and fastcall. The stack was not properly restored for both conventions and it was assumed that the first parameters would be passed in registers, but this does not have to be the case.

In the process I have also changed some indentation to be more consistent. A few files used mixed tabs/spaces for indentation; I have replaced the tabs with spaces.

References:
http://docwiki.embarcadero.com/RADStudio/en/Program_Control#Register_Convention
http://en.wikipedia.org/wiki/X86_calling_conventions#Callee_clean-up
https://code.google.com/p/corkami/wiki/CallingConventions