in Compiler Design edited by
450 views
0 votes
0 votes
what will be the three address code for x=A[i][j] Given A[M][N] and w is word size;

t1=i*N;

t2=t1+j;

t3=t2*w;

t4=base address of array A[M][N]

t5=t4+t3;

x=t5;

My doubt here: Is there any need of t4 variable for storing the base address of arrary or we can directly do it as

t4=A[t3];

x=t4;
in Compiler Design edited by
450 views

2 Comments

as per my knowledge,

it depends upon addressing modes which your architecture support
0
0
That mean depending on the architecture both are correct!
0
0

Please log in or register to answer this question.