float a[20][10];
use a[i][j+2]
HIR
|
MIR
|
LIR
|
t1 a[i,j+2]
|
t1 j+2
|
r1 [fp-4]
|
|
t2 i*20
|
r2 r1+2
|
|
t3 t1+t2
|
r3 [fp-8]
|
|
t4 4*t3
|
r4 r3*20
|
|
t5 addr a
|
r5 r4+r2
|
|
t6 t4+t5
|
r6 4*r5
|
|
t7 *t6
|
r7 fp-216
|
|
|
f1 [r7+r6]
|
|
|
|
This example shows the representation of the same code in three different IRs, all at different levels of abstraction. In the MIR, the size of the float and the array is used along with the address of the variable a . In the LIR, we are dealing with registers and file pointers instead (lower level of abstraction).
|