hw1-sols

hw1-sols - CS 243 Assignment 1 Assignment 1 Dataflow...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS 243 Assignment 1 Assignment 1 Dataflow Analysis Due: January 25, 11:00 am This is a written assignment, every student must hand in his or her homework. Bring your homework to class on January 25. SCPD students may submit their homework by e-mail via scpd-distribution@lists.stanford.edu or give your homework to the courier. 1. Compute the available expressions (Chapter 9.2.6 in ALSU) on entry and exit for each basic block in the flow graph below. entry t = x+y; c = a+b; b = t+c; a = t+c; b = 4; c = t+c; a = x+y; exit Solution: The most common error here was assuming that t + c was available after the expression c = t + c . Block In Out Entry- B1 { x+y, a+b } B2 { x+y, a+b } { x+y, t+c } B3 { x+y } { x+y, t+c } B4 { x+y } { x+y } B5 { x+y, t+c } { x+y } B6 { x+y } { x+y } Exit { x+y }- Winter 2011/2012 page 1 of 4 CS 243 Assignment 1 2. Is the following a meet operator? Please answer yes or no. No explanation is encessary. a. Maximum value (on integers) b. Product (on integers) c. Addition (on integers) d. Product mod 2 (on the set { 0, 1 } ) e. Addition mod 2 (on the set { 0, 1 } ) f. The GCD function (on integers) Solution: All the no answers failed because they were not idempotent (i.e., x x...
View Full Document

This document was uploaded on 03/12/2012.

Page1 / 5

hw1-sols - CS 243 Assignment 1 Assignment 1 Dataflow...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online