Spring 2011 CSCI 565 - Compiler Design
Spring 2011 CSCI 565 - Compiler Design
Spring 2011 CSCI 565 - Compiler Design
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Pedro Diniz<br />
pedro@isi.edu<br />
x = A[y,z];<br />
L.place = x<br />
L.offset = null<br />
x<br />
A<br />
S<br />
=<br />
Elist.place = y<br />
Elist.ndim = 1<br />
Elist.array = A<br />
[<br />
Elist.place = t1<br />
Elist.ndim = 2<br />
Elist.array = A<br />
E.place = y<br />
L.place = y<br />
y<br />
,<br />
L.offset = null<br />
<strong>CSCI</strong> <strong>565</strong> - <strong>Compiler</strong> <strong>Design</strong><br />
E.place = z<br />
L.place = z<br />
L.offset = null<br />
z<br />
E.place = t4<br />
L.place = t2<br />
L.offset = t3<br />
]<br />
<strong>Spring</strong> <strong>2011</strong><br />
SDT for Addressing Arrays Elements<br />
A is 10 x 20 array with low 1 = low 2 = 1<br />
sizeof(baseType(A)) = sizeof(int) = 4 bytes<br />
t1 = y * 20 // numElem(A,2) = 20<br />
t1 = t1 + z // E.place is z<br />
t2 = c // c = base(A) - (20+1)*4<br />
t3 = t1 * 4 // sizeof(int) = 4<br />
t4 = t2[t3]<br />
x = t4<br />
See page 383-384 of the textbook for an alternative approach