mikewalpole 发表于 2023-10-30 11:03

【keil】代码优化等级说明


[*]level 0 : Minimum optimization. Turns off most optimizations.It gives the best possible debug view and the lowest level of optimization.
最小优化。关闭大多数优化。它提供了最佳的调试视图和最低级别的优化。
[*]level 1 : Restrictedoptimization. Removes unused inline functions and unused static functions.Turns off optimizations that seriously degrade the debug view. Ifused with --debug, this option gives a satisfactorydebug view with good code density.
限制优化。删除未使用的内联函数和未使用的静态函数。关闭严重降低调试视图的优化。如果与--debug一起使用,该选项提供了一个具有良好代码密度的令人满意的调试视图。
[*]level 2 : Highoptimization. If used with--debug, the debug viewmight be less satisfactory because the mapping of object code tosource code is not always clear.
高度优化。如果与--debug一起使用,debug视图可能不太令人满意,因为目标代码到源代码的映射并不总是清晰的。
[*]level 3 : Maximumoptimization.-O3 performs the same optimizations as -O2.However the balance between space and timeoptimizations in the generated code is more heavily weighted towardsspace or time compared with-O2.
最大化优化。-O3执行与-O2相同的优化,但是生成代码中的空间和时间优化之间的平衡比S-O2更盛一筹。

MessageRing 发表于 2023-10-30 11:58

不同的优化等级有什么区别啊?

tpgf 发表于 2023-11-6 11:55

如果不做任何配置默认的是哪种优化登记啊

guanjiaer 发表于 2023-11-6 13:11

在什么情况下需要使用最高等级优化呢

heimaojingzhang 发表于 2023-11-6 14:25

我们可以通过自身编写代码的水平的提高来实现优化吗

paotangsan 发表于 2023-11-6 15:05

所有的单片机都只有这四种优化等级吗

renzheshengui 发表于 2023-11-6 22:22

这四种不同等级的代码优化等级的使用场合是怎么规定的呢

keaibukelian 发表于 2023-11-6 23:15

最高等级的优化会不会把我们不想要优化掉的给优化掉啊

chenjun89 发表于 2023-11-9 12:17

一般很少管,都是采用默认优化级别。
页: [1]
查看完整版本: 【keil】代码优化等级说明