COMPILER DESIGN

INTRODUCTION TO COMPILER DESIGN

OVERVIEW OF COMPILERS

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Replacing expensive operations with simpler ones is called
A
Strength reduction
B
Copy propagation
C
Constant folding
D
Dead code elimination
Explanation: 

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.

There is 1 question to complete.