Chapter 8 Code Optimization and Code Generation
Chapter 8 Code Optimization and Code Generation
Design
Chapter 8: Code optimization and code
generation
Contents
• Introduction to code optimization
a) Local optimization:
– Transformations are applied over a small
segment of the program called basic block, in
which statements are executed in sequential
order.
b) Global optimization
– Transformations are applied over a large
segment of the program like loop, procedures,
functions etc.
Types of Optimization - Basic Block
2. Algebraic transformations
Principle Sources of Optimization
Principle Sources of Optimization
Example-
Directed Acyclic Graph
Directed Acyclic Graph
Directed Acyclic Graph
CODE GENERATION
Issues in the Design of a Code Generator:
Input to Code Generator
– stack based.
Target Programs