Presentation is loading. Please wait.

Presentation is loading. Please wait.

From last class: CSE Want to compute when an expression is available in a var Domain:

Similar presentations


Presentation on theme: "From last class: CSE Want to compute when an expression is available in a var Domain:"— Presentation transcript:

1 From last class: CSE Want to compute when an expression is available in a var Domain:

2 Flow functions X := Y op Z in out F X := Y op Z (in) = X := Y in out F X := Y (in) =

3 Flow functions X := Y op Z in out F X := Y op Z (in) = in – { X ! * } – { * !... X... } [ { X ! Y op Z | X  Y Æ X  Z} X := Y in out F X := Y (in) = in – { X ! * } – { * !... X... } [ { X ! E | Y ! E 2 in }

4 Example

5 Problems Available expressions overly sensitive to name choices, operand orderings, renamings, assignments Use SSA: distinct values have distinct names Do copy prop before running available exprs Adopt canonical form for commutative ops

6 Example in SSA X := Y op Z in out F X := Y op Z (in) = X :=  (Y,Z) in 0 out F X := Y (in) = in 1

7 Example in SSA X := Y op Z in out F X := Y op Z (in) = in [ { X ! Y op Z } X :=  (Y,Z) in 0 out F X := Y (in) = in [ { X ! E | Y ! E 2 in 0 Æ Z ! E 2 in 1 } in 1

8 Example in SSA

9

10 What about pointers?

11 Option 1: don’t use SSA for point-to memory Option 2: insert copies between SSA vars and real vars

12 Loop-invariant code motion

13 Example

14 Detecting loop invariants

15 Computing loop invariants

16 Example using def/use chains

17

18 Loop invariant detection using SSA

19 Example using SSA

20 Example using SSA and preheader

21 Code motion

22 Example

23 Lesson from example: domination restriction

24 Domination restriction in for loops

25

26 Avoiding domination restriction

27 Another example

28 Data dependence restriction

29 Avoiding data restriction

30 More advanced control representations

31

32 The above is Click’s solution (PLDI 95)

33

34 More advanced control representations The Click algorithm shows the need to distinguish “dependance regions” Next lecture we’ll see how to do this.


Download ppt "From last class: CSE Want to compute when an expression is available in a var Domain:"

Similar presentations


Ads by Google