lecture-2 Intro (continued)

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

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

View Full Document Right Arrow Icon
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;
Background image of page 1

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

View Full DocumentRight Arrow Icon
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?
Background image of page 2
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; }
Background image of page 3

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

View Full DocumentRight Arrow Icon
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)
Background image of page 4
5 Another example area(h,w) { return h * w }
Background image of page 5

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

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

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 Right Arrow Icon
Ask a homework question - tutors are online