Home » Compiler Design » Compiler design miscellaneous » Question

Compiler design miscellaneous

  1. Which one of the following is FALSE?
    1. A basic block is a sequence of instructions where control enters the sequence at the beginning and exits at the end.
    2. Available expression analysis can be used for common subexpression elimination.
    3. Live variable analysis can be used for dead code elimination.
    4. x = 4 * 5 ⇒ x = 20 is an example of common subexpression elimination.
Correct Option: D

The statement:–
x = 4 × 5 ⇒ x = 20 ‘is an example of common subexpression elimination.] is False.
Explanation :
Common Subexpression elimination is a compiter optimization that searches for instances of identical expressions (that evaluate to same value) and analyses whether it is worthwhile replacing them with a single variable holding the computed value. example:
Z1 = (x + y) + 1;
Z2 = (x + y) + b;
Z3 = (x + y) + c;
Above code segment may be transformed to: tmp = x + y;
Z1 = tmp + a;
Z2 = tmp + b;
Z3 = tmp + c;
So, the addition (x + y) is performed only once. It is worth noting that the given option (D)
x = 4 × 5 ⇒ x = 20
is called the “constant folding” technique of compiler optimization.



Your comments will be displayed only after manual approval.