Explain the principal sources of optimization with suitable example.
Answers
Answered by
1
Answer:
PRINCIPAL SOURCES OF. OPTIMISATION
A transformation of a program is called local if it can be performed by looking only at the statements in a basic block; otherwise, it is called global. Many transformations can be performed at both the local and global levels. Local transformations are usually performed first.
Function-Preserving Transformations
- There are a number of ways in which a compiler can improve a program without changing the function its computes.
- examples:
Common sub expression elimination
Copy propagation,
Dead-code elimination
Constant folding
The other transformations come up primarily when global optimizations are performed.
Frequently, a program will include several calculations of the offset in an array. Some of the duplicate calculations cannot be avoided by the programmer because they lie below the level of detail accessible within the source language.
Similar questions