Three address code .
. Only one operator on the right hand side is allowed
. Source expression like x + y * z might be translated into
t 1 := y * z
t 2 := x + t 1
where t 1 and t 2 are compiler generated temporary names
. Unraveling of complicated arithmetic expressions and of control flow makes 3-address code desirable for code generation and optimization
. The use of names for intermediate values allows 3-address code to be easily rearranged
. Three address code is a linearized representation of a syntax tree where explicit names correspond to the interior nodes of the graph
Note that no built-up arithmetic expressions are permitted, as there is only one operator on the right side. Its advantage is that it can be easily rearranged. Each statement usually contains three addresses, two for the operands and one for the result. It is a linearized representation of a syntax tree in which explicit names correspond to the interior nodes of the graph. Variable names can appear directly in three address
statements, so there are no statements corresponding to the leaves.
The various types of the three-address code are shown in the next slide.
|