Header Ads Widget

Three address code

Three address code

  • Three-address code is an intermediate code. It is used by the optimizing compilers.
  • In three-address code, the given expression is broken down into several separate instructions. These instructions can easily translate into assembly language.
  • Each Three address code instruction has at most three operands. It is a combination of assignment and a binary operator.

Example

GivenExpression:

  1. a := (-c * b) + (-c * d)  

Three-address code is as follows:

         t1 := -c
         t2 := b*t1
         t3 := -c
         t4 := d * t3
         t5 := t2 + t4
         a := t5

t is used as registers in the target program.

The three address code can be represented in two forms: quadruples and triples.

Post a Comment

0 Comments