gcc 优化选项 -O1 -O2 -O3 -Os 优先级,-fomit-frame-pointer
四种编译优化类型的解释:
`-O '
`-O1 '
Optimize. Optimizing compilation takes somewhat more time, and a
lot more memory for a large function.
With `-O ', the compiler tries to reduce code size and execution
time, without performing any optimizations that take a great deal
of compilation time.
`-O ' turns on the following optimization flags:
-fdefer-pop
-fdelayed-branch
-fguess-branch-probability
-fcprop-registers
-floop-optimize
-fif-conversion
-fif-conversion2
-ftree-ccp
-ftree-dce
-ftree-dominator-opts
-ftree-dse
-ftree-ter
-ftree-lrs
-ftree-sra
-ftree-copyrename
-ftree-fre
-ftree-ch
-funit-at-a-time
-fmerge-constants
`-O ' also turns on `-fomit-frame-pointer ' on machines where doing
so does not interfere with debugging.
`-O ' doesn 't turn on `-ftree-sra ' for the Ada compiler. This
option must be explicitly specified on the command line to be
enabled for the Ada compiler.
`-O2 '
Optimize even more. GCC performs nearly all supported
optimizations that do not involve a space-speed tradeoff. The
compiler does not perform loop unrolling or function inlining when
you specify `-O2 '. As compared to `-O ', this option increases
both compilation time and the performance of the generated code.
`-O2 ' turns on all optimization flags specified by `-O '. It also
turns on the following optimization flags:
-fthread-jumps
-fcrossjumping
-foptimize-sibling-calls
-fcse-follow-jumps -fcse-skip-blocks
-fgcse -fgcse-lm
-fexpensive-optimizations
-fstrength-reduce
-frerun-cse-after-loop -frerun-loop-opt
-fcaller-saves
-fpeephole2
-fschedule-insns -fschedule-insns2
-fsched-interblock -fsched-spec
-fregmove
-fstrict-aliasing
-fdelete-null-pointer-checks
-freorder-blocks -freorder-functions
-falign-functions -falign-jumps
-falign-loops -falign-labels
-ftree-vrp
-ftree-pre
Please note the warning under `-fgcse ' about invoking `-O2 ' on
programs that use computed gotos.
`-O3 '
Optimize yet more. `-O3 ' turns on all optimizations specified by
`-O2 ' and also turns on the `-finline-functions ',
`-funswitch-loops ' and `-fgcse-after-reload ' options.
`-O0 '
Do not optimize. This is the default.
还有个常用的优化选项: -Os
它相当于-O2.5。是使用了所有-O2的优化选项,但又不缩减代码尺寸的方法。
编译选项:-mnohwloop 解决编译错误:中断处理函数里面添加log信息
相关文章
- os X下mds_stores占用大量cpu的解决办法
- 在VMwear 11中的Mac OS X 10.11+ 进入恢复模式(Recovery HD)
- 当云端嫁给Ylmf OS
- os.path模块【python】
- Python OS库详解(二)——OS库之进程管理和环境参数
- Atitit mac os 版本 新特性 attilax大总结
- Python编程语言学习:os模块/sys模块用法之获取当前系统环境的所有变量及其对应值、添加新的系统环境变量地址等案例之详细攻略
- OS和android游戏纹理优化和内存优化(cocos2d-x)
- VMware Workstation 14 安装 Mac OS
- 国产CPU和OS,四十不惑
- 恶意代码分析实战 隐蔽的恶意代码启动 lab12-1 12-2 12-3 12-4 进程注入、进程替换、hook procmon监控os api调用不行 数据分析还是要sysmon
- Python学习笔记之os模块
- Harmony OS — Text文本框
- OS实验六【设备管理】
- 华为:鸿蒙OS不是安卓和iOS的拷贝;胡润世界500强榜发布:苹果第一,腾讯第六