
Fourth (7 each) are void function ( struct *) and float function ( float, float).Īnother interesting aspect is looking at calls through function pointers. I guess that's mostly floating-point functions in the standard library. Third (17 functions) is float function ( float). Second (20 functions) is int function ( int). The most common function signature (21 functions) is void function ( void), where we can't do anything about the calling convention. the above data is about few functions that get called often, but there are also many functions that only get called from few locations each): While we have many calls to functions of the 5 types listed above, when we look at the types of functions, we see a different picture (i.e. This is a common function signature for string functions from the standard library. Fifth (46) common are calls to int function ( unsigned char *, unsigned char *, unsigned int). Here we have a lot of freedom, so experimenting with different calling conventions could give interesting insight. Third (49) is calls to int function ( int, int). And that one doesn't matter much, since users rarely use the return value of printf. Here we need to pass all parameters on the stack, and have the caller clean up the stack so our only choice is the register for the return value. Second (82) is to int function ( unsigned char *. These are mostly support routine calls: SDCC targets don't have hardware floating-point support, so every addition, multiplication, comparison of float results in a support function call. There are lots (233) of calls to float function (float, float) (actually the most common call) and _Bool function (float, float) (4th common at 48 calls). Such functions tend to not benefit from having the callee clean up the stack. There are many functions that are called just once or twice.
While surely not representative of general use of SDCC, there are still a few interesting aspects in the data: However, it also means we cannot distinguish between char and unsigned char. The data has been obtained at register allocation time, so inlined function calls are not in it, but calls to support library functions are.
#Raisonance free c compiler for stm8 code#
The attached file summarizes¹ function types and calls to them in a small sample of code consisitng of the standard library, and the Whetstone, Dhrystone, stdcbench and Coremark benchmarks.