四种编译优化类型的解释:

`-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的优化选项,但又不缩减代码尺寸的方法。

参考文档: https://www.linuxjournal.com/article/7269

https://www.cnblogs.com/dylancao/p/9528432.html

GCC 优化选项 -O1 -O2 -O3 -OS 优先级,-FOMIT-FRAME-POINTER(O3的优化很小,只增加了几条优化而已)的更多相关文章

  1. gcc 优化选项 -O1 -O2 -O3 -Os 优先级

    http://hi.baidu.com/xiaole10368/item/7cea9b1369cc240db88a1a5c 少优化->多优化: O0 -->> O1 -->&g ...

  2. gcc 优化选项 -O1 -O2 -O3 -Os 优先级,-fomit-frame-pointer

    英文:https://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/Optimize-Options.html#Optimize-Options 少优化->多优化: ...

  3. 警惕arm-linux-gcc编译器优化选项

    arm-linux-gcc的优化选项例如(-O2),可以加速我们的程序,使程序执行效率更高.但是,倘若我们就是需要程序慢一点运行,但是优化却把我们的延时函数优化的没有了的时候,这种优化却不是我们想要的 ...

  4. gcc -O0 -O1 -O2 -O3 四级优化选项及每级分别做什么优化【转】

    转自:http://blog.csdn.net/qinrenzhi/article/details/78334677 相关博客http://blog.chinaunix.net/uid-2495495 ...

  5. gcc -O0 -O1 -O2 -O3 四级优化选项及每级分别做什么优化

    参考链接 : http://blog.csdn.net/qq_31108501/article/details/51842166 gcc -D选项的作用,声明宏 参考链接:  http://blog. ...

  6. gcc/g++ -O 优化选项说明

    查查gcc手册就知道了,每个编译选项都控制着不同的优化选项 下面从网络上copy过来的,真要用到这些还是推荐查阅手册 -O设置一共有五种:-O0.-O1.-O2.-O3和-Os. 除了-O0以外,每一 ...

  7. gcc options选项的优化及选择

    gcc options选项的优化 -c和-o都是gcc编译器的可选参数[options] -c表示只编译(compile)源文件但不链接,会把.c或.cc的c源程序编译成目标文件,一般是.o文件.[只 ...

  8. GCC优化选项-fomit-frame-pointer对于esp和ebp优化的作用

    我的博客:www.while0.com -fomit-frame-pointer选项是发布产品时经常会用到的优化选项,它可以优化汇编函数中用edp协助获取堆栈中函数参数的部分,不使用edp,而是通过计 ...

  9. Object.assign(o1, o2, o3) 对象 复制 合拼

    Object 对象方法学习之(1)—— 使用 Object.assign 复制对象.合并对象 合并对象 var o1 = {a: 1}; var o2 = {b: 2}; var o3 = {c: 3 ...

随机推荐

  1. Pixhawk---基于NSH的Firmware开发与调试

    1 相关知识了解 1.1 Nuttx系统   嵌入式实时操作系统(RTOS). 强调标准兼容和小型封装,具有从8位到32位微控制器环境的高度可扩展性.NuttX 主要遵循 Posix 和 ANSI 标 ...

  2. Android 中View的绘制机制源代码分析 二

    尊重原创:http://blog.csdn.net/yuanzeyao/article/details/46842891 本篇文章接着上篇文章的内容来继续讨论View的绘制机制,上篇文章中我们主要解说 ...

  3. angularjs1-4 事件指令

    <div ng-app="myApp"> <div ng-controller="firstController"> <div n ...

  4. SpringBoot项目部署

    项目背景     个人博客:http://www.huangyichun.cn/blog/8     采用SpringBoot开发的个人博客,部署到腾讯云服务器上,服务器系统为ubuntu16.04, ...

  5. mybatis、spring、mysql、maven实现简单增删查改

    之前写过的mybatis博客作为学习mybatis.spring还是不太合适. 现在找到一个不错的例子,首先将这个完整的mybatis增删查改例子在本地上实现出来,然后再进行学习. 项目结构与运行结果 ...

  6. roscore不能启动

    通过VNC 在VNC窗口上出入 roscore  得到下面错误信息 ----------------------------------------------------------- proces ...

  7. ffmpeg键盘命令响应程序详解

    一.对终端进行读写 当一个程序在命令提示符中被调用时, shell负责将标准输入和标准输出流连接到你的程序, 实现程序与用户间的交互.   1. 标准模式和非标准模式 在默认情况下, 只有用户按下回车 ...

  8. Spark on YARN运行模式(图文详解)

    不多说,直接上干货! 请移步 Spark on YARN简介与运行wordcount(master.slave1和slave2)(博主推荐) Spark on YARN模式的安装(spark-1.6. ...

  9. 数组常用API

    内容待添加... //根据分数排名字 //方法1 var students = ['小明','小红','小花'] var scores = {小明:,小红:,小花:} //1 添加分数到student ...

  10. Sqlite简单操作

    1.student类 public class Student { int id; String name; String sex; String address; int money; public ...