MCS-388 Homework 4 (Spring 2008)

Due: April 7, 2008

  1. Do exercise 5.2.5 on page 317. Ignore the hint in exercise 5.2.4. A hint for 5.2.5 would be as follows: 101.101 can also be thought of as representing 5 5/8.

  2. Draw a DAG for the expression a-a-a-(a-a)-(a-a-a-a). Your DAG should show as much sharing as possible, the way the DAG produced by value numbering does.

  3. Translate the following assignment statement into three address code:

    a[i] = b[a[i]][j] + c[i+j];
    

    Assume that all array indexes start at zero, that the starting addresses of the three arrays are available as basea, baseb, and basec, that array b has 10 rows and 20 columns and is stored in row-major order, and that all array elements are 8 bytes in size.


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