search
Log In

Recent questions tagged code-optimization

0 votes
4 answers
1
0 votes
1 answer
2
The optimization phase in a compiler generally Reduces the space of the code Optimizes the code to reduce execution time Both (A) and (B) Neither (A) nor (B)
asked Mar 30 in Compiler Design Lakshman Patel RJIT 202 views
1 vote
1 answer
3
Replacing the expression $4\ast 2\cdot 14$ by $8 \cdot 56$ is known as constant folding induction variable strength reduction code reduction
asked Jul 2, 2019 in Compiler Design Arjun 440 views
0 votes
0 answers
4
0 votes
1 answer
5
A sequential search operation is performed on an array $A$ for the key value of $'x'$ (ignore quotes). Consider the following piece of assembly language code that uses back patching to perform the sequential search. i=0; P: if (i<A.length) goto ____; Q: goto ____; R: if (x==A[i] ... What should be the correct values in the blanks provided ordered from top to bottom? R T U P R U T P P U T R P T U R
asked Dec 27, 2018 in Algorithms Ruturaj Mohanty 141 views
0 votes
0 answers
6
Given the 3-address code for a basic block: The number of registers that are needed to allocate this basic block with no spills are ________.? My doubt here is : Is there any difference in question asking for minimum numbers of registers and minimum number ... If the question ask for minimum number of variables required in three address code, Only then should we optimize the code before counting?
asked Dec 23, 2018 in Compiler Design Shivam Kasat 203 views
0 votes
2 answers
8
In compiler optimization, operator strength reduction uses mathematical identities to replace slow math operations with faster operations. Which of the following code replacements is an illustration of operator strength reduction ? A. Replace P + P by 2 * P or Replace 3 + 4 by 7 B. Replace P * 32 by P < < 5 C. Replace P * 0 by 0 D. Replace (P < <4) – P by P * 15 pls explain your answer
asked Oct 1, 2018 in Compiler Design aditi19 178 views
0 votes
2 answers
9
DU-chains(Definition-Use) in compiler design: consist of a definition of a variable and all its uses, reachable from that definition are created using a form static code analysis are prerequisite for many compiler optimization including constant propagation and common sub-expression elimination All of the above
asked Apr 22, 2018 in Compiler Design Arjun 892 views
2 votes
2 answers
10
Which of the following comment about peep-hole optimization is true? It is applied to small part of the code and applied repeatedly It can be used to optimize intermediate code It can be applied to a portion of the code that is not contiguous It is applied in symbol table to optimize the memory requirements.
asked Apr 22, 2018 in Compiler Design Arjun 1.4k views
3 votes
2 answers
15
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 += ((4*j)+5*i); 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
asked Dec 17, 2017 in Compiler Design gatecse 981 views
0 votes
1 answer
17
Consider the following source code : c = a + b d = c c = c – e a = d – e b = b * e b = d/b (A) No optimization is possible (B) d = c c = c – e a = d – e b = b * e b = d/b (C) c = a + b d = c c = c – e a = d – e b = d/b (D) c = a + b t = b * e a = d – e b = d/t c = a
asked Mar 8, 2017 in Compiler Design Beyonder 1.9k views
0 votes
1 answer
18
0 votes
2 answers
20
0 votes
1 answer
21
11 votes
2 answers
22
Peephole optimization is form of Loop optimization Local optimization Constant folding Data flow analysis
asked Jul 4, 2016 in Compiler Design ManojK 5.9k views
1 vote
1 answer
23
Consider the following code which computes the inner product of 2 vectors: prod := 0; i := 1; repeat { prod := prod + a[i] * b[i] i = i+1; until i >20 } Below is possible IR for this program : 1) prod := 0 2) i :=1 3) t1 :=4*i 4) t2 :=a[t1] 5) t3 := ... 10)t7 := i+1 11) i :=t7 12) if i<=20 goto (3) 13) .. Create Basic Blocks and the control Flow Graph and also show any Optimizatioions.If you Find.
asked Jun 27, 2016 in Compiler Design LavTheRawkstar 841 views
6 votes
5 answers
24
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
asked Jun 21, 2016 in Compiler Design jothee 4.5k views
4 votes
3 answers
25
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
asked Jun 15, 2016 in Compiler Design Anuanu 4.6k views
6 votes
1 answer
26
Substitution of values for names (whose values are constants) is done in Local optimization Loop optimization Constant folding Strength reduction
asked Jun 3, 2016 in Compiler Design Desert_Warrior 3.4k views
1 vote
1 answer
27
In compiler design &lsquo;reducing the strength&rsquo; refers to reducing the range of values of input variables code optimization using cheaper machine instructions reducing efficiency of program none of the above
asked Jun 1, 2016 in Compiler Design Sanjay Sharma 1.5k views
3 votes
1 answer
28
14 votes
2 answers
29
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 ... this code segment without any spill to memory? Do not apply any optimization other than optimizing register allocation. 3 4 5 6
asked Apr 21, 2016 in Compiler Design jothee 2.7k views
0 votes
0 answers
30
WAREHOUSE------> FACTORY W1 W2 W3 SUPPLY F1 16 20 12 200 F2 14 8 16 160 F3 26 24 26 90 DEMAND 180 120 150 is the optimal solution for the above question or not ???
asked Jul 12, 2015 in Others Shubham Sahu 104 views
...