Peephole Optimization
Peephole Optimization
PEEPHOLE OPTIMIZATION
TYPES OF OPTIMIZATION
Optimization can be categorized broadly into
two types :
1. Machine independent
2. Machine dependent
Optimized code,
• Improve the quality of the target code,
• Improve runtime or space
• Executes Faster
• Code size get reduced
• Efficient memory usage
Peep hole optimization
• X *2=X+X
• X=x+0 These kind of instructions
can be removed.
• X=x+1 this can simply replaced by inc x
Use of machine idioms
• Target instructions have equivalent machine
instructions for performing some operations
• X=x+1 x++
• X=x-1 x--