Code Generation and Optimization (original) (raw)
Match the description of several parts of a classic optimizing compiler in List - I, with the names of those parts in List - II: 
Consider the following source code :
c = a + b d = c c = c – e a = d – e b = b * e b = d/b
Which of the following is correct optimization of given code?
- c = a + b
t = b * e
a = d – e
b = d/t
c = a - c = a + b
d = c
c = c – e
a = d – e
b = d/b - d = c
c = c – e
a = d – e
b = b * e
b = d/b
Consider the following expression
uv+a-bc
Which one of the following corresponds to a static single assignment from the above expressions
- x1 = a - b y1 = p * c x2 = u * v y2 = p + q
- x 1 = a - b y1 = x2 * c x3 = u * v y2 = x4 + y3
- x1 = a - b y2 = x1 * c x2 = u * v y3 = x2 + y2
- p = a - b q = p * c p = u * v q = p + q
Consider the code segment
int i, j, x, y, m, n;
n=20;
for (i = 0, i < n; i++)
{
for (j = 0; j < n; j++)
{
if (i % 2)
{
x + = ((4j) + 5i);
y += (7 + 4*j);
}
}
}
m = x + y;
Which one of the following is false
- The code contains loop invariant computation
- There is scope of common sub-expression elimination in this code
- There is scope of strength reduction in this code
- There is scope of dead code elimination in this code
Peephole optimization is form of
Which of the following is NOT represented in a subroutine's activation record frame for a stack-based programming language?
- Values of local variables
- Information needed to access non local variables
In compiler terminology reduction in strength means
- Replacing run time computation by compile time computation
- Removing loop invariant computation
- Removing common subexpressions
- replacing a costly operation by a relatively cheaper one
Which of the following statements about peephole optimization is False?
- It is applied to a small part of the code
- It can be used to optimize intermediate code
- To get the best out of this, it has to be applied repeatedly
- It can be applied to the portion of the code that is not contiguous
The use of multiple register windows with overlap causes a reduction in the number of memory accesses for I. Function locals and parameters II. Register saves and restores III. Instruction fetches
Substitution of values for names (whose values are constants) is done in
There are 38 questions to complete.
Take a part in the ongoing discussion