Question:
Is there any Pragma optimization techniques available for ARM as like #pragma optimize_off in Blackfin/SHARC?
Answer:
There is a GCC-specific set of pragmas are available from the below link:
https://gcc.gnu.org/onlinedocs/gcc-10.2.0/gcc/Function-Specific-Option-Pragmas.html
For example,
#pragma GCC push_options
#pragma GCC optimize ("O0")
some_function();
#pragma GCC pop_options
The optimization options that can be put into the pragma (or used on the command line) are documented here:
https://gcc.gnu.org/onlinedocs/gcc-10.2.0/gcc/Optimize-Options.html
As well as here’s an alternative option that’s a bit neater for function level optimization only using an inline attribute.
The optimize attribute to the function can be as below:
static __attribute__((optimize("O0"))) int SomeFunc(void)