Custom Calling Conventions

Calling conventions specify the way a function is called. The standard calling conventions, cdecl, place an underscore ('_') before the function name in the function's label and pass all parameters on the stack. The caller of the function must remove those arguments from the stack. Structure return values are also stored on the stack.

Conventional calling conventions are slow because they require all arguments and structure return values to be passed through memory and only 4-byte alignment is maintained. VectorC provides some custom calling conventions that can speed up function calling and return.

Codeplay's custom calling conventions cannot be called by code compiled in other compilers. You either need to compile all your code with VectorC or provide transfer functions compiled with VectorC, but with cdecl or fastcall calling conventions.

Using codeplay_mmx, codeplay_3dnow or codeplay_sse when compiling for processors with the necessary support can speed up function calls massively.

Also, all CodePlay calling conventions maintain 16-byte alignment which can speed up MMX, SSE and floating-point code dramatically. Using codeplay_mmx, codeplay_3dnow and codeplay_sse will let VectorC use MMX and 3DNow! in more places than it would otherwise. This is because these calling conventions assume the processor is in MMX mode at the point of call and return. The compiler therefore doesn't have to include the cost of switching FPU/MMX mode when deciding whether to use MMX for a particular function.

You can specify a default calling convention on the command line. This makes it easier if you want to compile your entire program with VectorC.