lecture-2 Intro (continued)

# lecture-2 Intro (continued) - Administrative info Subscribe...

This preview shows pages 1–6. Sign up to view the full content.

1 Administrative info • Subscribe to the class mailing list – instructions are on the class web page, which is accessible from my home page, which is accessible by searching for Sorin Lerner on google • Project page is up – Not much info there yet. More will be available by Thursday • You will need to create groups for the project by Thursday. So start thinking about who you would like to work with. Tour of common optimizations Simple example foo(z) { x := 3 + 6; y := x – 5 return z * y } Simple example foo(z) { x := 3 + 6; y := x – 5 return z * y } Another example x := a + b; ... y := a + b; Another example x := a + b; ... y := a + b;

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

View Full Document
2 Another example if (. ..) { x := a + b; } ... y := a + b; Another example if (. ..) { x := a + b; } ... y := a + b; Another example x := y ... z := z + x Another example x := y ... z := z + x Another example x := y ... z := z + y What if we run CSE now? Another example x := y ... z := z + y What if we run CSE now?
3 Another example x := y**z ... x := . .. Another example • Often used as a clean-up pass x := y**z ... x := . .. x := y z := z + x x := y z := z + y Copy prop DAE x := y z := z + y Another example if (false) { ... } Another example if (false) { ... } Another example • In Java: a := new int [10]; for (index = 0; index < 10; index ++) { a[index] := 100; } Another example • In “lowered” Java: a := new int [10]; for (index = 0; index < 10; index ++) { if (index < 0 || index >= a.length()) { throw OutOfBoundsException; } a[index] := 0; }

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

View Full Document
4 Another example • In “lowered” Java: a := new int [10]; for (index = 0; index < 10; index ++) { if (index < 0 || index >= a.length()) { throw OutOfBoundsException; } a[index] := 0; } Another example p := &x; *p := 5 y := x + 1; Another example p := &x; *p := 5 y := x + 1; x := 5; *p := 3 y := x + 1; ??? Another example for j := 1 to N for i := 1 to N a[i] := a[i] + b[j] Another example for j := 1 to N for i := 1 to N a[i] := a[i] + b[j] Another example area(h,w) { return h * w } h := . ..; w := 4; a := area(h,w)
5 Another example area(h,w) { return h * w }

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 8

lecture-2 Intro (continued) - Administrative info Subscribe...

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

View Full Document
Ask a homework question - tutors are online