MCS-388 Homework 4 (Spring 2014)

Due: March 21, 2014

  1. 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.

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

    a[i] = a[i] + b[c[i+j]][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: https://gustavus.edu/+max/courses/S2014/MCS-388/
Instructor: Max Hailperin <max@gustavus.edu>