In the context of compiler design, "reduction in strength" refers to
In the context of compiler design, "reduction in strength" refers to
Answer: A. code optimization obtained by the use of cheaper machine instructions — Reduction in Strength is a classic code optimization technique applied during the optimization phase of a compiler. The Goal: To replace an operation that is…
- A.
code optimization obtained by the use of cheaper machine instructions
- B.
reduction in accuracy of the output reduction in accuracy of the output
- C.
reduction in the range of values of input variables
- D.
reduction in efficiency of the program
Attempted by 117 students.
Show answer & explanation
Correct answer: A
Reduction in Strength is a classic code optimization technique applied during the optimization phase of a compiler.
The Goal: To replace an operation that is computationally expensive (takes more CPU cycles or complex circuitry) with an equivalent operation that is computationally cheaper (faster and simpler).
Classic Example: Replacing an expression involving multiplication (×) with an equivalent expression using repeated addition (+) or bit shifts (<<) within loops. For example, replacing i×2 with i+i or i<<1. Division and exponentiation can similarly be replaced by cheaper operations when possible.
Result: This leads to more efficient machine code, which means the program runs faster.