KEIL AC6優(yōu)化等級問題

Arm C/C++ (AC6) Compiler
Options dialog for ARM Compiler 6.
Language / Code Generation
Execute-only Code
Generates execute-only code, and prevents the compiler from generating any data accesses to code sections. Sets the compiler control string?-mexecute-only.
Optimization
Control compiler code optimization. Sets the compiler control string?-Onum|string.
<default>?— is the uVision default setting. Uses the default compiler level, or the setting from the uVision target or parent group. No compiler control string is set.
<默認(rèn)值>-是uVision默認(rèn)設(shè)置。使用默認(rèn)編譯器級別,或uVision目標(biāo)或父組中的設(shè)置。未設(shè)置編譯器控制字符串。
-O0?— is the compiler default level. Turns off most optimizations, except some simple source transformations. Using?-O0?results in a faster compilation and build time, but produces slower code than the other optimization levels. Code size and stack usage are also significantly higher.
-O0是編譯器默認(rèn)級別。關(guān)閉大多數(shù)優(yōu)化,但一些簡單的源代碼轉(zhuǎn)換除外。使用-00可以加快編譯和構(gòu)建速度,但生成的代碼比其他優(yōu)化級別慢。代碼大小和堆棧使用率也明顯較高。
-O1?— restricted optimization. This optimization level provides a good debug experience with better code quality than?-O0. Also the stack usage is improved over?-O0. Arm recommends this option for a good debug experience.
-O1限制優(yōu)化。此優(yōu)化級別提供了良好的調(diào)試體驗(yàn),代碼質(zhì)量優(yōu)于-00。此外,堆棧使用率在-00以上得到了提高。Arm建議使用此選項(xiàng)以獲得良好的調(diào)試體驗(yàn)。
-O2?— high optimization. The debug view might be less satisfactory because the mapping of object code to source code is not always clear. The compiler might perform optimizations that cannot be described by debug information.
-02高度優(yōu)化。調(diào)試視圖可能不太令人滿意,因?yàn)槟繕?biāo)代碼到源代碼的映射并不總是清晰的。編譯器可能會執(zhí)行調(diào)試信息無法描述的優(yōu)化。
-O3?— maximum optimization. This option typically gives a poor debug view.
-03最大優(yōu)化。此選項(xiàng)通常提供較差的調(diào)試視圖。
AC6新增優(yōu)化等級
-Ofast?— Enable all the optimizations from?-O3?along with other aggressive optimizations that might violate strict compliance with language standards, including?-ffast-math.
-Ofast支持-03中的所有優(yōu)化,以及其他可能違反嚴(yán)格遵守語言標(biāo)準(zhǔn)的激進(jìn)優(yōu)化,包括-ffast math。
-Os balanced?— Balances code size against code speed. By default, the compiler performs optimizations to increase performance, at the expense of a possible increase in image size. Sets the compiler control string?-Os.
-操作系統(tǒng)平衡了代碼大小和代碼速度。默認(rèn)情況下,編譯器會執(zhí)行優(yōu)化以提高性能,但可能會增加圖像大小。設(shè)置編譯器控制字符串-Os。
-Oz image size?— optimize for code size. By default, the compiler performs optimizations to increase performance, at the expense of a possible increase in image size. Sets the compiler control string?-Oz
-Oz圖像大小針對代碼大小進(jìn)行優(yōu)化。默認(rèn)情況下,編譯器會執(zhí)行優(yōu)化以提高性能,但可能會增加圖像大小。設(shè)置編譯器控制字符串-Oz。

arm官方文檔:https://developer.arm.com/documentation/101407/0537/Dialogs/Project/Options/Compiler/Arm-C-C----AC6--Compiler