Open In App

Introduction to Intermediate Representation(IR)

Intermediate Representation(IR), as the name suggests, is any representation of a program between the source and target languages. The intermediate form of the program that is being compiled is the central data structure in a compiler. A compiler may have a single IR or a series of IRs. The decisions that are made during the design of IR affect the efficiency and speed of the compiler.

Properties of IRs: 

The priorities of different properties across all compilers are not uniform.



The below five are the properties of IRs:

  1. Ease of generation
  2. Ease of manipulation
  3. Freedom of expression
  4. Size of the procedure
  5. Level of abstraction

Level of Abstraction: 

Reasons for using Intermediate Representations(IRs): 



  1. Translating the given code from one form to another requires synthesis and analysis.
  2. To perform machine-independent optimizations.
  3. To make translation simpler.

Types of IRs: 

There are three major categories of Intermediate Representation(IR).

1. Graphical IR:  

2. Linear IR: 

3. Hybrid IR: 

Naming Discipline in IRs: 

Article Tags :