FAQ: Optimizer in C/C++ compiler

Document created by Kader.M Employee on May 2, 2018
Version 1Show Document
  • View in full screen mode



I am debugging my program. I noticed the operator "if" are realized in disassembly but C/C++ code with the operator "if" don't be viewed in disassembly. Why?






The optimizer in the C/C++ compiler is designed to generate efficient code from source that has been written in a straightforward manner. The basic strategy for tuning a program is to present the algorithm in a way that gives the optimizer the best possible visibility of the operations and data, and hence the greatest freedom to safely manipulate the code.


As optimization happens, the code is transformed, duplicated, rearranged and rewritten in a multitude of different ways. This process breaks the simple one-to-one mapping between source code and the compiler's internal representation. As the aim is to produce the highest performing code possible, the optimization transformations are not constrained at all by the potential to map statements back to their source lines.


This will not cause any issues in execution of the "if" loops.


Please refer the below CCES help path for more information:
CrossCore® Embedded Studio 2.6.0 > SHARC® Development Tools Documentation > C/C++ Compiler Manual for SHARC® Processors > Optimal Performance from C/C++ Source Code