IAR #pragma optimize 指令

#pragma optimize= none  //one of none, low, medium, high, size, or speed放在被优化函数前 
#pragma optimize 指令
格式:
#pragma optimize=token token token
where token is one or more of the following:
s Optimizes for speed
z Optimizes for size
2|3|6|9 Specifies level of optimization
no_cse Turns off common sub-expression elimination
no_inline Turns off function inlining
no_unroll Turns off loop unrolling
no_code_motion Turns off code motion.

The #pragma optimize directive is used for decreasing the optimization level or for
turning off some specific optimizations. This #pragma directive only affects the
function that follows immediately after the directive.
Notice that it is not possible to optimize for speed and size at the same time. Only one
of the s and z tokens can be used.
Note: If you use the #pragma optimize directive to specify an optimization level that
is higher than the optimization level you specify using a compiler option, the #pragma
directive is ignored.
Example
#pragma optimize=s 9
int small_and_used_often()
{
...
}
#pragma optimize=z 9
int big_and_seldom_used()
{
...
}
/*======================================================================================
速度优化选项:
-s[2|3|6|9]
Use this option to make the compiler optimize the code for maximum execution speed.
If no optimization option is specified, the compiler will use the size optimization -z2
by default. If the -s option is used without specifying the optimization level, speed
optimization at level 2 is used by default.

*The most important difference between -s2 and -s3 is that at level 2, all non-static
variables will live during their entire scope.

大小优化选项
-z[2|3|6|9]
Use this option to make the compiler optimize the code for minimum size. If no
optimization option is specified, -z2 is used by default

*The most important difference between -z2 and -z3 is that at level 2, all non-static
variables will live during their entire scope.

2 None*
3 Low
6 Medium
9 High

IAR #pragma optimize 指令相关推荐

  1. 编译指令 #pragma optimize

    MSDN: https://docs.microsoft.com/en-us/cpp/preprocessor/optimize?redirectedfrom=MSDN&view=vs-201 ...

  2. pragma comment的使用 pragma预处理指令详解

    pragma comment的使用 pragma预处理指令详解 #pragma comment( comment-type [,"commentstring"] ) 该宏放置一个注 ...

  3. #pragma comment和#pragma 预处理指令详解

    该宏放置一个注释到对象文件或者可执行文件. 例如,#pragma   comment(lib,"Ws2_32.lib")表示链接Ws2_32.lib这个库. 和在工程设置里写上链入 ...

  4. #pragma预处理指令详解

    #pragma预处理指令详解 在所有的预处理指令中,#Pragma指令可能是最复杂的了,它的作用是设定编译器的状态或者是指示编译器完成一些特定的动作.#pragma指令对每个编译器给出了一个方法,在保 ...

  5. iar c语言指令,IAR中工程相关配置及c语言易忘知识点

    使用K60单片机时,往往使用IAR的比较多.但是我之前一直使用KEIL来进行stm32的开发,所以就有一种先入为主的观念,总觉得KEIL比IAR要好一些.随着和IAR打交道越来越多,渐渐地发现IAR也 ...

  6. IAR之IAR EWARM软件软件配置

    IAR之IAR EWARM软件软件配置 转自:http://www.360doc.com/content/16/0415/10/32464717_550770606.shtml IAR EWARM软件 ...

  7. pragma指令简介

    在编写程序的时候,我们经常要用到#pragma指令来设定编译器的状态或者是指示编译器完成一些特定的动作. 下面介绍了一下该指令的一些常用参数,希望对大家有所帮助! 一. message 参数. mes ...

  8. #pragma指令与#ifndef指令

    #pragma指令与#ifndef指令 在C/C++中,在使用预编译指令#include的时候,为了防止重复引用造成二义性,通常有两种方式-- 第一种是#ifndef指令防止代码块重复引用,比如说 # ...

  9. 解析#pragma指令

    #pragma指令对每个编译器给出了一个方法,在保持与 C和C++语言完全兼容的情况下,给出主机或操作系统专有的特征.依据定义,编译指示是机器 或操作系统专有的,且对于每个编译器都是不同的. 其格式一 ...

最新文章

  1. sql server 数据库模型 备份 恢复 总结 备份脚本
  2. Java新手看招 常用开发工具介绍
  3. SAP Fiori Tools 和对应的 CLI (Command Line Interface)
  4. 大数据、java、python、区块链、人工智能哪个发展前景更好?
  5. java 异步阻塞_大白话搞懂什么是同步/异步/阻塞/非阻塞
  6. C# 与C++的数据转换
  7. pass by value pass by reference
  8. TortoiseGit 安装
  9. 计算机专业学习课程推荐
  10. 任意切换线程的工具类
  11. Android 功能系列篇
  12. 用R语言实现对不平衡数据的四种处理方法
  13. 南油外服-网易游戏测试(外包) 面试
  14. Number 数字类型详解
  15. 程序员光学技术还不够?推荐一份运营书单给你品一品
  16. 看MySQL数据库的观后感,【看点·光】谈谈赏析和读后感(随笔)_mysql执行语句...
  17. 如何化解濒临离婚边缘的婚姻危机
  18. python 全栈开发,Day128(创建二维码,扫码,创建玩具的基本属性)
  19. C#实现Gauss完全主元消去法
  20. 华为云服务器型号解析——通用计算型

热门文章

  1. 4.5.3 循环控制语句
  2. 自定义oracle异常,Oracle自定义异常
  3. linux复制压缩文件夹,[操作系统]linux中文件或者文件夹的基本操作(复制,移动,删除,查找,压缩)...
  4. 操作系统(李治军) L9多进程图像-操作系统最重要的图像
  5. tomcat-servlet-AJAX最基础例子
  6. 深度学习基础(综述及名词解释)
  7. 我的世界SkyPixel像素天空HTML官网源码
  8. 好看的导航网站源码-简约自适应网站网址导航系统
  9. 创意夜晚行驶迷路网站404页面源码
  10. WinRAR 6.0 官方版 非常强大好用的压缩包管理器