Is the __fastcall call necessary or not?

7

What is the use of __ fastcall in calling functions in C ++?

    
asked by anonymous 15.12.2017 / 04:59

1 answer

5

Most of the time, the calling convention is not considerable. When using the fastcall convention, the first arguments are passed through standard call registers.

In too succinct functions or that are called in a single point of the whole program, it is best to implement inline with its consequent optimizations, which does not even result in calls at runtime. In other cases, it depends on many factors, such as the location of the data before, during and after the call. For example, machine instructions that require input data into specific registers (such as mul , imul , div and idiv ) and it is good that the calling convention used favors this.

If you need extreme performance and can measure with enough precision, which is difficult, you can try it to see if it pays off. The gain can be derisory and often it is necessary to make adaptations that damage the code. In some architectures, one does not even try to use it, even it is common in modern architectures to be slower than other conventions of calls, making the use rare.

    
15.12.2017 / 05:08