0% found this document useful (0 votes)
30 views3 pages

QB Unit - V1

The document contains questions about compiler design and code generation. It includes one mark, two mark, five mark and ten mark questions related to topics like peephole optimization, basic blocks, flow graphs, addressing modes, code optimization techniques, DAG representation, instruction cost calculation and code generation algorithms.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views3 pages

QB Unit - V1

The document contains questions about compiler design and code generation. It includes one mark, two mark, five mark and ten mark questions related to topics like peephole optimization, basic blocks, flow graphs, addressing modes, code optimization techniques, DAG representation, instruction cost calculation and code generation algorithms.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

COMPILER DESIGN

QUESTION BANK

UNIT - V

ONE MARK QUESTIONS

1. Define peephole optimization.


2. What is basic block?
3. What is a flow graph?
4. Mention the applications of DAGs.
5. Define reloadable object module.
6. What is meant by multiregister operations?
7. What is register descriptor?
8. What is address descriptor?
9. What are the various forms of target programs?
10. What is the output of the code generation?
11. Code generation is the Back end? [ True/False]
12. Code generation is the front end? [ True/False]

13. Code optimization is the optional phase of a compiler? [True/False]

14. What are the phases in the Backend of a compiler?

15. List the types of addressing modes?


16. What is input to code generator?
17. How would you calculate the cost of an instruction?
18. What are the common methods for associating actual and formal
parameters?
19. Define Live and dead variables?
20. What is the use of Optimized machine code phase?

TWO MARK QUESTIONS

1. What are the various algorithms for code generation from DAG?
2. Consider the following code sequence
MOV B, R0
ADD C, R0
MOV R0,A Calculate the cost of above instructions.
3. What is the cost of the following set of instructions
mov *R1, * R0 add *R2,*R0
4. Generate a code for following statements
a =b+c; d=a+e;
5. Consider the following code sequence
MOV B, A
ADD C, A
Calculate the cost of above instructions.
6. What are the characteristics of peephole optimization?
7. Calculate the cost of following set of instructions?
MOV a,R0 ADD b,R0 MOV R0,c
8. Give two examples of machine idioms?
9. Give two examples for Algebraic simplification?
10. Give two examples for redundant instruction elimination?

FIVE MARK QUESTIONS

1. Write a short notes on the Target Machine?


2. What are the object code forms? Explain about them?
3. Give the DAG of the following basic block
d := b * c e := a + b b := b * c a := e – d
Then generate the code for above constructed DAG using only R0.
4. Compute the DAG for the following three address statements.
Considering this DAG as an example, explain the process of code
generation from DAG.
t1 = a + b t2 = c + d t3 = e – t2 t4 = t1 - t3
5. What are the steps needed to compute the next use information?
6. Generate the code sequence using code generation algorithm for the
following expression W = ( A – B ) + ( A – C) + ( A – C )
7. For the following expression (a+b) – (c-(d+e)) generate the optimal code
using I) one register ii) two register
8. Generate the optimal code for the following
i) x = a+b+c ii) x = (a * -b) + ( c – (d + e))
9. Write a short notes on the following
I) Redundant instruction elimination ii) Algebraic Simplification
iii) Machine idioms IV) Copy Propagation
10. Explain about the phases of code generation and Optimized code
generation?

TEN MARK QUESTIONS

1. What is code generator? Explain design issues of code generator.


2. Explain about peephole optimization.
3. Explain the simple code generator with a suitable example.
4. Generate the code for the following expression using code generation
algorithm.
x = ( a + b) * (c – d) + ((e/f)*(a+b))
5. Explain the DAG representation of the basic block with example.
6. What is Optimization? Explain the principle sources of optimization?
7. Explain the importance of optimization with example and explain the
types of Optimization?
8. Explain the terms
i. Algebric Simplification
ii. DU and UD Chains.
iii. Instruction Cost
iv. DAG
9. Write the reasons for Optimized machine code phase is more important
than Code Optimization phase. Explain with example.
10. Explain the role of
i. Code optimization
ii. Code Generation phases of compiler.

You might also like