GATE CS Local Optimization questions
Practise Local Optimization questions for GATE CS. Explore official PYQs and original topic-wise quizzes, check answers and view available solutions. Free, no sign-in.
Subject, topic, year and type filter the full library. Match any choice within a filter, and all selected filter categories. Search, source and sort apply to this page.
13 on this page
Consider the control flow graph given below. Which one of the following options is the set of live variables at the exit point of each basic block?
Which ONE of the following techniques used in compiler code optimization uses live variable analysis?
Consider the following code segment: a = b + c; e = a + 1; d = b + c; f = d + 1; g = e + f; In a compiler, this code segment is represented internally as a directed acyclic graph . The number of nodes in the is _____________
Consider the following code segment: z=x + 3 + y->f1 + y->f2; for (i = 0; i < 200; i = i + 2) { if (z > i) { p = p + x + 3; q = q + y->f1; } else { p = p + y->f2; q = q + x + 3; } } Assume that the variable points to a (allocated on the heap) containing two fields and …
In the context of abstract-syntax-tree (AST) and control-flow-graph (CFG), which one of the following is TRUE?
Which one of the following is FALSE?
Consider the basic block given below. a = b + c c = a + d d = b + c e = d - b a = e + b The minimum number of nodes and edges present in the DAG representation of the above basic block respectively are
The minimum number of arithmetic operations required to evaluate the polynomial for a given value of , using only one temporary variable is ______.
The following code segment is executed on a processor which allows only register operands in its instructions. Each instruction can have atmost two source operands and one destination operand. Assume that all variables are dead after this code segment. c = a + b; d = c * a; e = c + a; x = c * c; if (x > a) { y = a * a; } else { d = d * d; e = e * e; } …
Some code optimizations are carried out on the intermediate code because
Consider the following C code segment. for (i = 0, i < n; i++) { for (j = 0; j < n; j++) { if (i%2) { x += (4*j + 5*i); y += (7 + 4*j); } } } Which one of the following is false?
Consider these two functions and two statements S1 and S2 about them. int work1(int *a, int i, int j) { int x = a[i+2]; a[j] = x+1; return a[i+2] - 3; } int work2(int *a, int i, int j) { int t1 = i+2; int t2 = a[t1]; a[j] = t2+1; return t2 - 3; } S1: The transformation form work1 to work2 is valid, i.e., for any program state and input arguments, work2 will …
Consider the grammar rule for arithmetic expressions. The code generated is targeted to a CPU having a single user register. The subtraction operation requires the first operand to be in the register. If and do not have any common sub expression, in order to get the shortest possible code
