0% found this document useful (0 votes)
93 views2 pages

Compiler Design

The document discusses key concepts in compiler design including: 1) Peephole optimization involves optimizing small sequences of instructions. A code generator should be machine independent, handle complex addressing modes, and optimize for speed and size. 2) A DAG (directed acyclic graph) is a graph with nodes and edges with a direction that does not form cycles. DAGs are used in code optimization to represent the data and control dependencies between instructions. 3) Basic blocks are sequences of instructions with one entry and exit point. Control flow graphs represent the flow of a program using basic blocks and edges. 4) Activation records store local variables, parameters, return addresses, and more during procedure calls.

Uploaded by

Shubham Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
93 views2 pages

Compiler Design

The document discusses key concepts in compiler design including: 1) Peephole optimization involves optimizing small sequences of instructions. A code generator should be machine independent, handle complex addressing modes, and optimize for speed and size. 2) A DAG (directed acyclic graph) is a graph with nodes and edges with a direction that does not form cycles. DAGs are used in code optimization to represent the data and control dependencies between instructions. 3) Basic blocks are sequences of instructions with one entry and exit point. Control flow graphs represent the flow of a program using basic blocks and edges. 4) Activation records store local variables, parameters, return addresses, and more during procedure calls.

Uploaded by

Shubham Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

5CS4-02: Compiler Design

Q.1 Write short Answers


(i) Define peephole optimization
(ii) Mention the properties that a code generator should possess
(iii) What is a DAG? Mention its applications
(iv) What are the basic goals of code movement?.
(v) What are the different data flow properties?
(vi) Write difference between ‘Call by Value’ and ‘Call by Reference’

(vii) What is Basic block?

(viii) What is Control flow graph?

(ix) What is Activation Record? Explain its format.

(x) What is Symbol table?

(xi) Explain the storage allocation strategies.

(xii) Explain the flow graph with example.

(xiii) Explain the basic block with example.

(xiv) Explain the difference between stack allocation and heap allocation.

(xv) Explain the code motion with example.

Q.2 (i) What are the contents of activation record?


(ii) What are the different data flow properties?
(iii) What do you mean by machine dependent and machine independent
optimization.
(iv) (a)Differentiate between stack allocation and heap allocation (b) machine
idioms
(v) What are the basic goals of code movement
(vi) Explain the symbol table management system.
(vii) Explain all the issues of Source Language.
(viii) What is the difference between local and non local data? Explain with
example.
(ix) Construct the DAG and generate the code for given block
d: = b+c
e: = a*b
b: = b-c
a: = e*d
(x) Explain loop invariant computation by using LICM algorithm
(xi) Explain Peephole optimization with example
(xii) Write appropriate method for constructing a DAG for a basic block.
(xiii) Explain optimization of basic blocks.
(xiv) Explain general structure of an activation record.
(xv) Construct the DAG for the following block of statements:
a=b*c
d=b
e=d*c
b=e
f=b+c
g=f+d
(xvi) Explain principal source of code optimization.
(xvii) Explain loop invariant computation.

Q.3 (i)
Mention the issues to be considered while applying the techniques for code
optimization
(ii) Explain the various runtime storage management technique, with suitable
programming example
(iii) What do you understand by DAG? Write an algorithm for constructing a DAG

(iv) What is Calling sequence? Explain the process of calling sequence for a
procedure.

(v) Write an algorithm to divide a program into basic blocks with the help of
program code with example.

(vi) Explain the issues in Code generation technique?

(vii) Explain peephole optimization.

(viii) Explain the list data structure foe symbol tables.

(ix) Explain the symbol table management system.

You might also like