Often the programmer needs control over the definition and usage of calling conventions of functions in order to achieve maximum performance. Also, calling functions (that may use non-standard conventions) written in assembly from C/C++ requires the compiler to know about these conventions.
The Codeplay compilers provide a solution to define custom calling convention inside a program. The pragma vectorc_conventions is used to specify the conventions (location of parameters (registers, stack), used/modifedĀ registers, stack cleanup responisibility (call or callee) etc.:
For example:
#pragma vectorc_conventions "myconventions":params {eax, ebx, ecx,
mm0, mm1, xmm1, xmm2},
return {eax, edx, mm0, xmm0},
structreturn {esi}, calleecleanup,
modifies {edx, esi, edi, mm0, mm1, mm2};
This calling convention myconventions can then be attached (using a declspec) to a function declaration: