11.07.2015 Views

MSP430 IAR C/C++ Compiler reference guide - Rice University

MSP430 IAR C/C++ Compiler reference guide - Rice University

MSP430 IAR C/C++ Compiler reference guide - Rice University

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Efficient coding for embedded applicationsOPTIMIZATION LEVELSThe <strong>MSP430</strong> <strong>IAR</strong> C/<strong>C++</strong> <strong>Compiler</strong> supports different levels of optimizations. Thefollowing table lists the optimizations that are performed on each level:Optimization levelNone (Best debug support)DescriptionDead code eliminationRedundant label eliminationRedundant branch eliminationLowMediumHigh (Maximum optimization)Table 26: <strong>Compiler</strong> optimization levelsNote: Some of the performed optimizations can be individually enabled or disabled.For more information about these, see Fine-tuning enabled transformations, page 122.A high level of optimization might result in increased compile time, and will most likelyalso make debugging more difficult, because it will be less clear how the generated coderelates to the source code. For example, at the low, medium, and high optimizationlevels, variables do not live through their entire scope, which means processor registersused for storing variables can be reused immediately after they were last used. Due tothis, the C-SPY Watch window might not be able to display the value of the variablethroughout its scope. At any time, if you experience difficulties when debugging yourcode, try lowering the optimization level.SPEED VERSUS SIZENote: Variables live through their entire scopeSame as above but variables only live for as long as they areneeded, not necessarily through their entire scopeSame as aboveLive-dead analysis and optimizationCode hoistingRegister content analysis and optimizationCommon subexpression eliminationSame as abovePeephole optimizationCross jumpingCross callLoop unrollingFunction inliningCode motionType-based alias analysisAt the high optimization level, the compiler balances between size and speedoptimizations. However, it is possible to fine-tune the optimizations explicitly for eithersize or speed. They only differ in what thresholds that are used; speed will trade size forPart 1. Using the compiler121

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!