MCS-388 Homework 5 (Spring 2003)

Due: May 2, 2003

Do Exercise 10.1 on pages 711-712 of the textbook, but skip parts b and h, and see below for some modifications. Also, briefly describe any major opportunities for optimizing this routine that are not covered by the exercise. Keep in mind that on contemporary machines, it is memory accesses that are generally the most time consuming operations.

Assume that the arrays a, b, and c are indexed from 1 to n in each dimension. Assume that you know at compile time that n is 500 and that the arrays a, b, and c start at addresses 20000, 3000000, and 5000000, respectively.

In your three address code, do not use the bracket notation, but rather do the address addition explicitly.

Create a new temporary for each value, rather than trying to be frugal and re-use temporaries. That is, do something like

    t1 := i * n
    t2 := t1 + j
not
    t1 := i * n
    t1 := t1 + j


Course web site: http://www.gac.edu/~max/courses/S2003/MCS-388/
Instructor: Max Hailperin <max@gac.edu>