Machine Dependent Code Optimization in Compiler Design


Machine Dependent Code Optimization in Compiler Design

In this article, you will learn in detail Machine Dependent Code Optimization in Compiler design so read the article.

Machine Dependent Code Optimization in Compiler Design
Machine Dependent Code Optimization in Compiler Design

What is Machine Dependent Optimization?

Machine-based optimization entails transformations that take into account the target machine’s properties, such as registers and special machine instruction sequences, among other things. These techniques are used on the target code that is produced.
The following measures are used to achieve computer-dependent optimization:

  • Allocation of adequate number of resources to enhance the execution efficiency of the program
  • Use of immediate instructions wherever required
  • The use of intermix instructions

Why is Machine Dependent Optimization Needed?

Most compilers use a statement-by-statement code generation approach, which results in a target code that contains redundant instructions and suboptimal constructs.
Some machine-dependent transformations are added to such code to boost it.
The peephole optimization technique is a straightforward and efficient machine-dependent process.

What is Peephole Optimization?

It’s a basic but successful technique for enhancing the target code on a local level.
This technique aims to increase the target code’s efficiency by looking at a short series of target instructions called a peephole and replacing them with a shorter, faster sequence wherever possible.

What is Peephole?

It is a short goal instruction series. On the target application, the peephole can be thought of as a moving window. The directions in the peephole do not have to be consecutive.

What is the characteristic of Peephole Optimization?

One of the characteristics of peephole optimization is that one change will lead to more opportunities for improvement. As a result, several passes over the target programme are needed to get the most value from this technique.

What are the Transformations done in Peephole Optimization?

In general peephole optimization involves the following six transformations:

  • Redundant instruction elimination
  • Unreachable code elimination
  • The flow of control optimization
  • Algebraic simplification
  • Reduction in strength
  • Use of machine idioms

Read More –

Other Resources –

Optimizing Compiler


Please enter your comment!
Please enter your name here