The Gateway to Computer Science Excellence
+19 votes
2k views

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 \Rightarrow x=20$ is an example of common subexpression elimination.
in Compiler Design by Veteran (105k points)
retagged by | 2k views
0

Constant propagation is the process of substituting the values of known constants in expressions at compile time.
(D) is an example of constant propagation, note that it's not constant folding.

2 Answers

+21 votes
Best answer
  1. A basic block is a sequence of instructions where control enters the sequence at the beginning and exits at the end is TRUE.
     
  2. Available expression analysis can be used for common subexpression elimination is TRUE. Available expressions is an analysis algorithm that determines for each point in the program the set of expressions that need not be recomputed. Available expression analysis is used to do global common subexpression elimination (CSE). If an expression is available at a point, there is no need to re-evaluate it.
     
  3. Live variable analysis can be used for dead code elimination is TRUE.
     
  4. $x = 4 ∗ 5 \Rightarrow x = 20$ is an example of common subexpression elimination is FALSE. Common subexpression elimination (CSE) refers to compiler optimization replaces identical expressions (i.e., they all evaluate to the same value) with a single variable holding the computed value when it is worthwhile to do so Source: Geeksforgeeks

Correct Answer: $D$

by Active (1.9k points)
edited by
+14
Option D is called constant folding

https://en.wikipedia.org/wiki/Constant_folding
0
@ryan it's not constant folding, but it is constant propagation.
+2
it is constant folding
0
What is difference between constant propagation and constant foldingg
0 votes
answer - D
by Loyal (8.6k points)

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,647 questions
56,503 answers
195,503 comments
100,867 users