Tool/software: TI C/C++ Compiler
Recently one of our applications blew out its memory. We took two paths to solve the issue:
1)Analyze the map file and remove any functions that have been included by un-executable code. This actually solved the problem.
2)Another path was to increase the optimization level. Moving from off to 0-Register Optimizations reduced code size by 25%, level one got us another 6%, each additional level help between -1 and 4%.
We had a discussion on optimization levels. We agreed that we should stay away from higher optimization levels because:
1)Stepping through the code gets harder and at times next to impossible
2)We distrust the upper levels.
The compiler writers need to get pretty tricky at some point and some of those tricks may not be abundantly tested.
Experience has shown that when updating to a new version of compiler, it is the highly optimized code that breaks.
But that 25% savings for just the first level of optimization is pretty tempting if we get in a pinch.
So where are these optimization levels defined? If no where, what are 'register optimizations'?
I can guess function arguments and registers are more optimized, as are local variables vs stack vs register? What else?
How would stepping through C code with CCS be changed? Would the differences only be seen in stepping through the assembler window?