INTRODUCTION TO COMPILER DESIGN
OVERVIEW OF COMPILERS
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
Strength reduction
|
|
Copy propagation
|
|
Constant folding
|
|
Dead code elimination
|
Detailed explanation-1: -In software engineering, strength reduction is a compiler optimization where expensive operations are replaced with equivalent but less expensive operations.
Detailed explanation-2: -Strength reduction : There are expressions that consume more CPU cycles, time, and memory. These expressions should be replaced with cheaper expressions without compromising the output of expression. For example, multiplication (x * 2) is expensive in terms of CPU cycles than (x « 1) and yields the same result.
Detailed explanation-3: -Replace P * 32 by P < < 5 => Strength reduction as shifting is faster than multiplication. So B is correct.
Detailed explanation-4: -removing loop invariant computation. replacing run-time computation by compile time computation. replacing a costly operation by a relatively cheaper one. removing common sub-expressions.