Hello,
I noticed opt_for_speed is still on the command line even though opt_level=off.
Does opt_for_speed have any effect on the code if opt_level=off?
If it does, how do I remove the opt_for_speed option?
Stephen
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello,
I noticed opt_for_speed is still on the command line even though opt_level=off.
Does opt_for_speed have any effect on the code if opt_level=off?
If it does, how do I remove the opt_for_speed option?
Stephen
stevenh said:Does opt_for_speed have any effect on the code if opt_level=off?
I'm pretty sure it does. Though the effect is likely to be less noticeable with no optimization. I'll have to confirm all this and get back to you.
stevenh said:If it does, how do I remove the opt_for_speed option?
The trade-off between size and speed is always present. Thus it does not make sense to turn it off. If you do not use the --opt_for_speed option at all, then the compiler defaults to --opt_for_speed=2.
Thanks and regards,
-George
When the optimization level is off, that means the Optimizer component of the compiler tool chain is never invoked. The Optimizer performs high-level optimizations. However, a compiler makes all sorts of decisions in the process of generating machine code. Many of these decisions occur in the back end as part of the process of generating machine code. The --opt_for_speed option is really to specify the tradeoff preference between code size and performance. It does have an effect even when high-level optimization is off, but it is unlikely one would see any performance benefits when optimization is disabled. With optimization disabled, your best bet is to prioritize code size and set --opt_for_speed to 0. Inside CCS, to see if this setting has any impact on your project, you could use the Optimizer Assistant to automatically generate all the opt_for_speed variants and see the code size differences in the resulting graph.
Ok.
Page 55 of the TMS320C28x Optimizing C/C++ Compiler v6.4 has the following:
--opt_level=off or -Ooff
– Performs no optimization
Does that mean the --opt_level=off description is incorrect.
Also, according to page 66 of the user guide, --opt_for_speed=2 doesn't exactly eliminate optimization.
--opt_for_speed=2
Enables optimizations geared towards improving the code size with a low risk of worsening or
impacting performance.
Stephen
Hello Anna,
There might be some situations that someone might want to disable optimization altogether.
optimizing for speed could cause code to be removed or registers/stack to be used instead of place of memory. Similar things could be said about optimizing for space.
Is the opt_for_speed and opt_for_space only available in the the C2000 compiler? I don't remember it being in the gnu compiler.
When was the opt_for_speed and opt_for_space added to the compiler?
If the opt_for_speed and opt_for_space wasn't always an option, was the size vs speed tradeoff always a part of the compiler?
Stephen