You are on page 1of 2

SET- II

Register Number:

PSNA COLLEGE OF ENGINEERING & TECHNOLOGY, DINDIGUL


DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
Serial Test - III
CS8602 – Compiler Design
Class : III yr CSE Date :
Faculty Name : V.Nanda kumar Duration : 90 minutes
Course Outcome Question Numbers Weightage of Marks
CO5:Implement various types of storage Part-A : 1,2,3,4,5
allocation strategies and a simple code Part-B :10 (a) / 10(b) 20
generator.
CO6:Learn to implement code optimization Part-A : 6,7,8,9
techniques Part-B :11(a) / 11(b) 30
Part-C :12

PART A — (9 × 2 = 18 marks)

1 What are the limitations of static allocation? (K1)


2 What is register descriptor and address descriptor? (K1)
3 List out the issues in the design of code generators? (K1)
4 Why is it necessary to generate intermediate code instead of generating target program (K2)
itself?
5 Differentiate stack and Heap allocation strategies. (K1)
6 What is Code motion? (K1)
7 Write the rules for header in basic blocks. (K2)
8 What is meant by peephole optimization? (K1)
9 Define Live variable? (K1)

PART B — (2 × 10 = 20 marks)

10 a) Discuss the various storage allocation strategies in detail. 10 (K5)


OR
b) Analyze and Generate code for the following assignment using the code
generator algorithms.
10 (K6)
(a-b) + (a-c) + (a-c)

11 a) Construct the DAG for the following Basic block & explain it.
1. t1: = 4 * i
2. t2:= a [t1]
3. t3: = 4 * i
4. t4:= b [t3]
5. t5:=t2*t4
6. t6:=Prod+t5
10 (K6)
7. Prod:=t6
8. t7:=i+1
9. i:= t7
10. if i<= 20 goto (1).

OR
b) 6 (K5)
i) Explain in detail about global data flow analysis.

ii) Optimize and develop this code by eliminating common sub expression,
performing reduction in strength on induction variables and eliminating all the
variable you can.
t6 = 4 * i
x = a[t6]
t7 = 4 * i
t8 = 4 * j
t9 = a[t8] 4 (K6)
t10 = 4 * j
a[t10]= x
goto B2
B2: i = i + 1
t2 = 4 * i
t3 = a[t2]
if t3 < a[t1] goto B2

PART C — (1 × 12 = 12 marks)

12 a) Explain loop optimization in detail and apply it to the


code given below.
i= 0
a:=n-3
if I < a then loop else end
label loop
b:= i -4
c:= p + b
12 (K5)
d := m[c]
e := d-2
f:= i – 4
g:= p + f
m[g]:= e
i = i +1
a:= n- 3
if i < a then loop else end

Faculty In-charge Course Coordinator HOD/CSE

You might also like