Introduction to Code Optimization

Estudies4you
Code Optimization:
Reasons for Optimizing the Code
                To improve performance and efficiency of a source code
                To produce efficient target code by reducing the number of instructions in a program
Definition:
                Code optimization is the process of reducing the number of instructions without affecting the outcome of the source program
Introduction to Code Optimization,Reasons for Optimizing the Code, definition of code optimization, role of code optimization, compiler design lecture notes jntu, architecture of code optimization, types of code optimization, levels of code optimization, Classification of Code Optimization, Machine Dependent code optimization, Machine Independent code optimization, estudies4you, jntuh rr16 compiler design notes, jntuh compiler design lecture notes pdf, jntuh 3-1 b.tech compiler design classroom notes unitwise, kiran kumar varaka

Role of a Code optimization:
  • It is a fifth phase of a compiler and optional phase in which code may or may not be optimized
  • It takes intermediate form of a source code as its input and generates optimized code if possible
  • Code optimization associates with symbol table to retrieve required information or store the information to process the source code
Introduction to Code Optimization,Reasons for Optimizing the Code, definition of code optimization, role of code optimization, compiler design lecture notes jntu, architecture of code optimization, types of code optimization, levels of code optimization, Classification of Code Optimization, Machine Dependent code optimization, Machine Independent code optimization, estudies4you, jntuh rr16 compiler design notes, jntuh compiler design lecture notes pdf, jntuh 3-1 b.tech compiler design classroom notes unitwise, kiran kumar varaka

The code becomes inefficient because of two factors. They are
                Programmer
                Compiler
Optimization can be done at three levels. They are
  • Writing efficient code with minimum the number of instructions by a programmer known as source code
  • The optimization can be applied on an intermediate code which is the output of intermediate code generation phase called as machine independent code optimization
  • The optimization can be applied on object code which is the output of code generator phase called machine dependent code optimization
Classification of Code Optimization:
The classification of optimization can be done in two ways:
                Machine Dependent code optimization
                Machine Independent Code Optimization


Machine Dependent code optimization
  • The machine dependent optimization can be achieved using following criteria
  • Allocation of sufficient number of resources to improve the execution efficiency of the program
  • Using immediate instructions wherever necessary
  • The use of intermix instructions. The intermixing of instruction along with the data increases the speed of execution
Machine Independent code optimization
The machine independent optimization can be achieved using the following criteria
  • The code should be analysed completely and use alternative equivalent sequence of source code that will produce a minimum amount of target code
  • Use appropriate program structure in order to improve the efficiency of target code
  • From the source program eliminate the unreachable code
  • Move two or more identical computations at one place and make use of the result instead of each time computing the expressions
To Top