Wednesday, December 4, 2013

Prevent GCC from auto-inline a function

Sometimes GCC goes too "smart" by inlining a function (put entire block of it's code directly in place) rather than assembling it as normal subroutine (block of code invoked by RCALL/CALL instruction and returns with RET instruction).

You can tell GCC not to automatically inline a specific function by declaring noinline attribute modifier before function type declaration. For example:
__attribute__((noinline)) int myStrictFunction() { }

No comments:

Post a Comment