Construction of Static Single-Assignment Form

Size: px
Start display at page:

Download "Construction of Static Single-Assignment Form"

Transcription

1 COMP 506 Rice University Spring 2018 Construction of Static Single-Assignment Form Part II source IR IR target code Front End Optimizer Back End code Copyright 2018, Keith D. Cooper & Linda Torczon, all rights reserved. Students enrolled in Comp 506 at Rice University have explicit permission to make copies of these materials for their personal use. Faculty from other educational institutions may use these materials for nonprofit educational purposes, provided this copyright notice is preserved Section numbers refer to EaC2e.

2 SSA Construction Algorithm (High-level sketch) Conceptually, the algorithm is simple 1. Insert ø-functions where distinct values come together 2. Rename values to maintain the principle of static single assignment that s all... of course, there is some bookkeeping to be done... COMP 506, Spring

3 SSA Construction (semi-pruned SSA) 1. Insert ø-functions a. Calculate dominance frontier b. Find global names For each name, build a list of blocks that define it c. Using dominance frontiers, insert ø-functions for each global name Creates the iterated dominance frontier " global name n " block b in which n is assigned " block d in b s dominance frontier insert a ø-function for n in d add d to n s list of defining blocks Critical, but moderately complex; DFs guide ø-function insertion Compute list of blocks where each name is assigned & use as a worklist This adds to the worklist Use a checklist to avoid putting blocks on the worklist twice; Use another checklist to avoid inserting the same ø-function twice. Algorithm, except for 1.b, is from CFRWZ [110]. See in EaC2e. COMP 506, Spring

4 SSA Construction (semi-pruned SSA) 2. Rename variables in a pre-order walk over the dominator tree (use an array of stacks, one stack per global name) Starting with the root block, b 1 counter per global name for the subscript a. Generate unique names for the result of each ø-function b. Rewrite each operation in the block i. Rewrite uses of global names with the current version number (from its stack) ii. Rewrite definition by incrementing the version number & pushing it on the stack c. Fill in ø-function parameters for successor blocks of b Reset the state to d. Recurse on b s children in the dominator tree IDOM(b) s e-o-b state e. <on exit from block b> pop the names generated in b from the stacks Need the end-of-block names for this path Algorithm, except for 1.b, is from CFRWZ [110]. See in EaC2e. COMP 506, Spring

5 SSA Construction (semi-pruned SSA) 1. Insert ø-functions a. Calculate dominance frontier focus on this step b. Find global names For each name, build a list of blocks that define it c. Using dominance frontiers, insert ø-functions for global names " global name n " block b in which n is assigned " block d in b s dominance frontier insert a ø-function for n in d add d to n s list of defining blocks COMP 506, Spring

6 Dominance Frontiers & ø-function Insertion Where does an assignment in block n induce a ø-function? If n DOM m, there is no need for a ø-function in m The definition in n blocks any previous definition from reach m If m has multiple predecessors and n dominates one of them, but not all of them, then m needs a ø-function for each name defined in n (Def n of DOM) More formally, m is in the dominance frontier of n, written m DF(n), iff 1. p predecessors(m) such that n DOM(p), and 2. n does not strictly dominate m (n DOM(m) { m }) Define Strict IDOM(x) The dominance frontier precisely describes where to insert ø-functions: A definition in block n requires a ø-function in each block in DF(n) Strict dominance allow a ø-function at the head of a single-block loop. COMP We say 506, x Spring STRICT 2018 IDOM(y) if x IDOM(y) and x y. 6

7 Dominance Frontiers n n p q p q m m All of m s CFG predecessors are dominated by n n DOM(m) m DF(n) n DOM(m) & n DOM(p) m DF(n) COMP If n DOM(m), 506, Spring n DOM(p), 2018 & n DOM(q), then m does not matter to DF(n) 7

8 Dominance & Dominance Frontiers Example B 0 B 2 B 3 Results of iterative solution for DOM DOM 0 0,1 0,1,2 0,1,3 0,1,3,4 0,1,3,5 0,1,3,6 0,1,7 IDO M B 4 B 5 Control Flow Graph COMP 506, Spring

9 Dominance & Dominance Frontiers Example B 0 B 2 B 3 Results of iterative solution for DOM DOM 0 0,1 0,1,2 0,1,3 0,1,3,4 0,1,3,5 0,1,3,6 0,1,7 IDO M B 4 B 5 Dominator Tree COMP 506, Spring

10 Dominance & Dominance Frontiers Example B 0 x ø(...) B 2 B 3 x B... 4 B 5 x ø(...) Dominance Frontiers & ø-function Insertion A definition at n forces a ø-function at m iff n Ï DOM(m) but n Î DOM(p) for some p Î preds(m) DF(n ) is fringe just beyond region n dominates DOM 0 0,1 0,1,2 0,1,3 0,1,3, 4 0,1,3,5 0,1,3, 6 DF (strict) DF(4) is {6}, so in 4 forces ø-function in 6 x ø (...) in 6 forces ø-function in DF(6) = {7} 0,1,7 Control Flow Graph in 7 forces ø-function in DF(7) = {1} in 1 forces ø-function in DF(1) = {1} (halt the ø-function is already there ) For each assignment, we insert the ø-functions COMP 506, Spring

11 Dominance & Dominance Frontiers Example B 0 B 2 B 3 B 4 B 5 Control Flow Graph DOM 0 0,1 0,1,2 0,1,3 0,1,3,4 0,1,3,5 0,1,3,6 0,1,7 Strict DF Computing Dominance Frontiers Only join points are in DF(n) for some n Leads to a simple, intuitive algorithm for computing dominance frontiers For each join point x (i.e., preds(x) > 1) For each CFG predecessor p of x Run from p to IDOM(x) in the dominator tree, & add x to DF(n) for each n from p up to but not STRICT IDOM(x) Consider, which is a join point B 2 is a CFG predecessor & not IDOM( ) DF(B 2 ) is B 2 s dom. tree ancestor, but is IDOM( ) stop is a CFG predecessor & not IDOM( ) DF( ) B 3 is B 2 s dom. tree ancestor & not IDOM( ) DF( ) is B 2 s dom. tree ancestor, but is IDOM( ) stop COMP 506, Spring

12 Dominance & Dominance Frontiers Example B 0 B 2 B 3 B 4 B 5 Control Flow Graph DOM 0 0,1 0,1,2 0,1,3 0,1,3,4 0,1,3,5 0,1,3,6 0,1,7 Strict DF Computing Dominance Frontiers Only join points are in DF(n) for some n Leads to a simple, intuitive algorithm for computing dominance frontiers For each join point x (i.e., preds(x) > 1) For each CFG predecessor p of x Run from p to IDOM(x) in the dominator tree, & add x to DF(n) for each n from p up to but not IDOM(x) For some applications (other than building SSA), we need post-dominance, the post-dominator tree, and reverse dominance frontiers, RDF(n) u Just dominance on the reverse CFG u Reverse the edges & add unique exit node We will use these ideas in dead code elimination COMP 506, Spring

13 SSA Construction (semi-pruned SSA) 1. Insert ø-functions a. Calculate dominance frontier b. Find global names focus on this step For each name, build a list of blocks that define it c. Using dominance frontiers, insert ø-functions for global names " global name n " block b in which n is assigned " block d in b s dominance frontier insert a ø-function for n in d add d to n s list of defining blocks A global name is LIVE on entry to some block. Step 1.b is not in the CFRWZ algorithms [110]. It shrinks the set of names for which ø-functions are inserted [50]. COMP 506, Spring

14 SSA Construction (semi-pruned SSA) Finding global names The difference between minimal SSA [110] and semi-pruned SSA [50] Semi-pruned only insert ø-functions for names that are LIVE on entry to some block 1 Shrinks the name space, the number of ø-functions, & the number of stacks Savings in construction time more than pays for the cost of the analysis Building semi-pruned is faster, in practice, than building minimal For each global name, need a list of blocks where it is defined That list drives ø-function insertion Block b defines x implies a ø-function for x in every c DF(b) Pruned SSA adds a test to see if x is globally LIVE at the insertion point Occasionally, building pruned SSA is faster than building semi-pruned SSA. Any algorithm that has non-linear behavior in the number of Ø-functions will have a size where pruned is the SSA flavor of choice. 1 COMP Can use 506, a Spring local 2018 notion of LIVE an upward exposed variable 14

15 SSA Construction (semi-pruned SSA) 1. Insert ø-functions a. Calculate dominance frontier b. Find global names For each name, build a list of blocks that define it c. Using dominance frontiers, insert ø-functions for global names " global name n " block b in which n is assigned " block d in b s dominance frontier insert a ø-function for n in d add d to n s list of defining blocks COMP 506, Spring

16 Example Lots of assignments Expression details elided B 0 i a c B 2 b c d B 4 B 3 d a d B 5 c Assume that a, b, c, & d are defined somewhere before B 0 y a+b z c+d i i+1 b Strict DF COMP 506, Spring

17 Example Afterø-function insertion Lots of new ops Ready for renaming B 0 i a Ø(a,a) b Ø(b,b) c Ø(c,c) d Ø(d,d) i Ø(i,i) a c B 2 b c d B 4 B 3 d a d B 5 c Excluding local names (semi-pruned) avoids ø- functions for x & y in Strict DF a Ø(a,a) b Ø(b,b) c Ø(c,c) d Ø(d,d) y a+b z c+d i i+1 d Ø(d,d) c Ø(c,c) b COMP 506, Spring Earlier example shows iterated insertion. (Slide 10)

18 SSA Construction One Final Point About ø-function Insertion ø-functions have an unusual semantics When execution enters a block, all the ø-functions evaluate their arguments, in parallel, and then perform their assignments, in parallel This behavior allows the compiler to manipulate ø-functions without worrying about the order in which they appear at the head of a block The parallel semantics of ø-functions will introduce complications when the compiler has to translate code in SSA form back into executable code (see in EaC2e) COMP 506, Spring

19 SSA Construction (semi-pruned SSA) 2. Rename variables in a pre-order walk over the dominator tree (use an array of stacks, one stack per global name) Starting with the root block, b a. Generate unique names for the result of each ø-function b. Rewrite each operation in the block i. Rewrite uses of global names with the current version number (from its stack) ii. Rewrite definition by incrementing the version number & pushing it on the stack c. Fill in ø-function parameters for successor blocks of b d. Recurse on b s children in the dominator tree e. <on exit from block b> pop the names generated in b from the stacks COMP 506, Spring

20 SSA Construction (semi-pruned SSA) Adding the details... for each global name i counter[i] 0 stack[i] Ø call Rename(n 0 ) NewName(n) i counter[n] counter[n] counter[n] + 1 push n i onto stack[n] return n i Minor engineering nit: assume, up front, that all names were converted to unique small integers Rename(b) for each ø-function in b, x ø ( ) rename x as NewName(x) for each operation x y op z in b rewrite y as top(stack[y]) rewrite z as top(stack[z]) rewrite x as NewName(x) for each successor of b in the CFG rewrite appropriate ø parameters for each successor s of b in dom. tree Rename(s) for each operation x y op z in b or each phi-function pop(stack[x]) COMP 506, Spring

21 B 0 i Example a Ø(a,a) b Ø(b,b) c Ø(c,c) d Ø(d,d) i Ø(i,i) a c Before processing B 0 B 2 b c d B 4 B 3 d a d B 5 c Assume a, b, c, & d defined before B 0 a Ø(a,a) b Ø(b,b) c Ø(c,c) d Ø(d,d) y a+b z c+d i i+1 d Ø(d,d) c Ø(c,c) b Counters Stacks a b c d i a 0 b 0 c 0 d 0 i has not been defined COMP 506, Spring

22 B 0 i 0 Example a Ø(a 0,a) b Ø(b 0,b) c Ø(c 0,c) d Ø(d 0,d) i Ø(i 0,i) a c End of B 0 B 2 b c d B 4 B 3 d a d B 5 c a Ø(a,a) b Ø(b,b) c Ø(c,c) d Ø(d,d) y a+b z c+d i i+1 d Ø(d,d) c Ø(c,c) b Counters Stacks a b c d i a 0 b 0 c 0 d 0 i 0 COMP 506, Spring

23 B 0 i 0 Example a 1 Ø(a 0,a) b 1 Ø(b 0,b) c 1 Ø(c 0,c) d 1 Ø(d 0,d) i 1 Ø(i 0,i) a 2 c 2 End of B 2 b c d B 4 B 3 d a d B 5 c a Ø(a,a) b Ø(b,b) c Ø(c,c) d Ø(d,d) y a+b z c+d i i+1 d Ø(d,d) c Ø(c,c) b Counters Stacks a b c d i a 0 b 0 c 0 d 0 i 0 a 1 b 1 c 1 d 1 i 1 a 2 c 2 COMP 506, Spring

24 B 0 i 0 Example a 1 Ø(a 0,a) b 1 Ø(b 0,b) c 1 Ø(c 0,c) d 1 Ø(d 0,d) i 1 Ø(i 0,i) a 2 c 2 End of B 2 B 2 b 2 c 3 d 2 B 4 B 3 d a d B 5 c a Ø(a 2,a) b Ø(b 2,b) c Ø(c 3,c) d Ø(d 2,d) y a+b z c+d i i+1 d Ø(d,d) c Ø(c,c) b Counters Stacks a b c d i a 0 b 0 c 0 d 0 i 0 a 1 b 1 c 1 d 1 i 1 a 2 b 2 c 2 d 2 c 3 COMP 506, Spring

25 B 0 i 0 Example a 1 Ø(a 0,a) b 1 Ø(b 0,b) c 1 Ø(c 0,c) d 1 Ø(d 0,d) i 1 Ø(i 0,i) a 2 c 2 Before starting B 3 B 2 b 2 c 3 d 2 B 4 B 3 d a d B 5 c a Ø(a 2,a) b Ø(b 2,b) c Ø(c 3,c) d Ø(d 2,d) y a+b z c+d i i+1 d Ø(d,d) c Ø(c,c) b i 100 Counters Stacks a b c d i a 0 b 0 c 0 d 0 i 0 a 1 b 1 c 1 d 1 i 1 a 2 c 2 COMP 506, Spring

26 B 0 i 0 Example a 1 Ø(a 0,a) b 1 Ø(b 0,b) c 1 Ø(c 0,c) d 1 Ø(d 0,d) i 1 Ø(i 0,i) a 2 c 2 End of B 3 B 2 b 2 c 3 d 2 B 4 B 3 d a 3 d 3 B 5 c a Ø(a 2,a) b Ø(b 2,b) c Ø(c 3,c) d Ø(d 2,d) y a+b z c+d i i+1 d Ø(d,d) c Ø(c,c) b Counters Stacks a b c d i a 0 b 0 c 0 d 0 i 0 a 1 b 1 c 1 d 1 i 1 a 2 c 2 a 3 d 3 COMP 506, Spring

27 B 0 i 0 Example a 1 Ø(a 0,a) b 1 Ø(b 0,b) c 1 Ø(c 0,c) d 1 Ø(d 0,d) i 1 Ø(i 0,i) a 2 c 2 End of B 4 B 2 b 2 c 3 d 2 B 4 d 4 B 3 a 3 d 3 B 5 c a Ø(a 2,a) b Ø(b 2,b) c Ø(c 3,c) d Ø(d 2,d) y a+b z c+d i i+1 d Ø(d 4,d) c Ø(c 2,c) b Counters Stacks a b c d i a 0 b 0 c 0 d 0 i 0 a 1 b 1 c 1 d 1 i 1 a 2 c 2 a 3 d 3 d 4 COMP 506, Spring

28 B 0 i 0 Example a 1 Ø(a 0,a) b 1 Ø(b 0,b) c 1 Ø(c 0,c) d 1 Ø(d 0,d) i 1 Ø(i 0,i) a 2 c 2 End of B 5 B 2 b 2 c 3 d 2 B 3 a 3 d 3 B 4 B 5 c 4 d 4 a Ø(a 2,a) b Ø(b 2,b) c Ø(c 3,c) d Ø(d 2,d) y a+b z c+d i i+1 d Ø(d 4,d 3 ) c Ø(c 2,c 4 ) b Counters Stacks a b c d i a 0 b 0 c 0 d 0 i 0 a 1 b 1 c 1 d 1 i 1 a 2 c 2 d 3 a 3 c 4 COMP 506, Spring

29 B 0 i 0 Example a 1 Ø(a 0,a) b 1 Ø(b 0,b) c 1 Ø(c 0,c) d 1 Ø(d 0,d) i 1 Ø(i 0,i) a 2 c 2 End of B 2 b 2 c 3 d 2 d 4 B 3 a 3 d 3 B 4 B 5 c 4 a Ø(a 2,a 3 ) b Ø(b 2,b 3 ) c Ø(c 3,c 5 ) d Ø(d 2,d 5 ) y a+b z c+d i i+1 d 5 Ø(d 4,d 3 ) c 5 Ø(c 2,c 4 ) b 3 Counters Stacks a b c d i a 0 b 0 c 0 d 0 i 0 a 1 b 1 c 1 d 1 i 1 a 2 b 3 c 2 d 3 a 3 c 5 d 5 COMP 506, Spring

30 B 0 i 0 Example a 1 Ø(a 0,a) b 1 Ø(b 0,b) c 1 Ø(c 0,c) d 1 Ø(d 0,d) i 1 Ø(i 0,i) a 2 c 2 Before start of B 2 b 2 c 3 d 2 d 4 B 3 a 3 d 3 B 4 B 5 c 4 a Ø(a 2,a 3 ) b Ø(b 2,b 3 ) c Ø(c 3,c 5 ) d Ø(d 2,d 5 ) y a+b z c+d i i+1 d 5 Ø(d 4,d 3 ) c 5 Ø(c 2,c 4 ) b 3 Counters Stacks a b c d i a 0 b 0 c 0 d 0 i 0 a 1 b 1 c 1 d 1 i 1 a 2 c 2 Popped COMP 506, all the Spring way back 2018to end of 30

31 B 0 i 0 Example a 1 Ø(a 0,a 4 ) b 1 Ø(b 0,b 4 ) c 1 Ø(c 0,c 6 ) d 1 Ø(d 0,d 6 ) i 1 Ø(i 0,i 2 ) a 2 c 2 After B 2 b 2 c 3 d 2 d 4 B 3 a 3 d 3 B 4 B 5 c 4 a 4 Ø(a 2,a 3 ) b 4 Ø(b 2,b 3 ) c 6 Ø(c 3,c 5 ) d 6 Ø(d 2,d 5 ) y a 4 +b 4 z c 6 +d 6 i 2 i 1 +1 d 5 Ø(d 4,d 3 ) c 5 Ø(c 2,c 4 ) b 3 Counters Stacks a b c d i a 0 b 0 c 0 d 0 i 0 a 1 b 1 c 1 d 1 i 1 b 4 a 2 c 2 d 6 i 2 a 4 c 6 COMP 506, Spring

32 B 0 i 0 Example a 1 Ø(a 0,a 4 ) b 1 Ø(b 0,b 4 ) c 1 Ø(c 0,c 6 ) d 1 Ø(d 0,d 6 ) i 1 Ø(i 0,i 2 ) a 2 c 2 After renaming Semi-pruned SSA form No Ø s for y or z in We are done B 2 b 2 c 3 d 2 d 4 B 3 a 3 d 3 B 4 B 5 c 4 d 5 Ø(d 4,d 3 ) c 5 Ø(c 2,c 4 ) b 3 a 4 Ø(a 2,a 3 ) b 4 Ø(b 2,b 3 ) c 6 Ø(c 3,c 5 ) d 6 Ø(d 2,d 5 ) y a 4 +b 4 z c 6 +d 6 i 2 i 1 +1 COMP 506, Spring

33 Flavors of SSA We have seen naïve and semi-pruned SSA. Are there other flavors? Naïve, minimal, semi-pruned, pruned are all well known They differ in the number of extraneous ø-functions that they insert Extra Ø-functions Reason Naïve Stupidly many ø-functions Did not use DF in insertion Minimal Name defined & used in 1 block still gets ø-functions Semi-pruned Global names get Ø-functions even when dead Considers full name space & ignores liveness Uses an approximation to substitute for liveness Pruned 1 Explicit test for liveness Solves & uses LIVE The improvements come from more careful ø-function insertion in step 1 In practice the modifications to step 1 are not complex 1 J.D. Choi, R. Cytron, & J. Ferrante, Automatic construction of sparse data flow evaluation graphs, POPL 91, pages COMP 506, Spring

34 One Last Point, If Time Permits Interpreting SSA Form as a Graph We can interpret the SSA Form of the code as a graph sum = 0 do i = 1 to 100 sum = sum + a(i) end do A simple example loop Short-lived temporary values loadi 0 Þ r s0 loadi 1 Þ r i0 loadi 100 Þ r 100 loop: phi r s0,r s2 Þ r s1 phi r i0,r i2 Þ r i1 subi r i1,1 Þ r 1 multi r 1,4 Þ r 2 addi r 2,@a Þ r 3 load r 3 Þ r 4 add r 4,r s1 Þ r s2 addi r i1,1 Þ r i2 cmp_lt r i2,r 100 Þ r 5 cbr r 5 loop,exit exit:... The example in semi-pruned SSA Form COMP 506, Spring

35 Interpreting SSA Form as a Graph We can interpret the SSA Form of the code as a graph Short-lived temporary values loadi 0 Þ r s0 loadi 1 Þ r i0 loadi 100 Þ r 100 loop: phi r s0,r s2 Þ r s1 phi r i0,r i2 Þ r i1 subi r i1,1 Þ r 1 multi r 1,4 Þ r 2 addi r 2,@a Þ r 3 load r 3 Þ r 4 add r 4,r s1 Þ r s2 addi r i1,1 Þ r i2 cmp_lt r i2,r 100 Þ r 5 cbr r 5 loop,exit exit:... The example in semi-pruned SSA Form load The SSA Form viewed as a Graph COMP 506, Spring r i0 r i1 1 Ø + r i2 r r 2 + r 3 cmp_lt r 5 cbr pc 100 r 4 r s0 r s1 r s2 0 Ø +

Lecture 11: Data Flow Analysis III

Lecture 11: Data Flow Analysis III CS 515 Programming Language and Compilers I Lecture 11: Data Flow Analysis III (The lectures are based on the slides copyrighted by Keith Cooper and Linda Torczon from Rice University.) Zheng (Eddy) Zhang

More information

Lecture Overview SSA Maximal SSA Semipruned SSA o Placing -functions o Renaming Translation out of SSA Using SSA: Sparse Simple Constant Propagation

Lecture Overview SSA Maximal SSA Semipruned SSA o Placing -functions o Renaming Translation out of SSA Using SSA: Sparse Simple Constant Propagation 1 Lecture Overview SSA Maximal SSA Semipruned SSA o Placing -functions o Renaming Translation out of SSA Using SSA: Sparse Simple Constant Propagation [Chapter 9] 2 SSA Revisited It is desirable to use

More information

Computing Static Single Assignment (SSA) Form

Computing Static Single Assignment (SSA) Form Computing Static Single Assignment (SSA) Form Overview What is SSA? Advantages of SSA over use-def chains Flavors of SSA Dominance frontiers revisited Inserting φ-nodes Renaming the variables Translating

More information

What is SSA? each assignment to a variable is given a unique name all of the uses reached by that assignment are renamed

What is SSA? each assignment to a variable is given a unique name all of the uses reached by that assignment are renamed Another Form of Data-Flow Analysis Propagation of values for a variable reference, where is the value produced? for a variable definition, where is the value consumed? Possible answers reaching definitions,

More information

Lecture 10: Data Flow Analysis II

Lecture 10: Data Flow Analysis II CS 515 Programming Language and Compilers I Lecture 10: Data Flow Analysis II (The lectures are based on the slides copyrighted by Keith Cooper and Linda Torczon from Rice University.) Zheng (Eddy) Zhang

More information

: Advanced Compiler Design Compu=ng DF(X) 3.4 Algorithm for inser=on of φ func=ons 3.5 Algorithm for variable renaming

: Advanced Compiler Design Compu=ng DF(X) 3.4 Algorithm for inser=on of φ func=ons 3.5 Algorithm for variable renaming 263-2810: Advanced Compiler Design 3.3.2 Compu=ng DF(X) 3.4 Algorithm for inser=on of φ func=ons 3.5 Algorithm for variable renaming Thomas R. Gross Computer Science Department ETH Zurich, Switzerland

More information

Class 5. Review; questions. Data-flow Analysis Review. Slicing overview Problem Set 2: due 9/3/09 Problem Set 3: due 9/8/09

Class 5. Review; questions. Data-flow Analysis Review. Slicing overview Problem Set 2: due 9/3/09 Problem Set 3: due 9/8/09 Class 5 Review; questions Assign (see Schedule for links) Slicing overview Problem Set 2: due 9/3/09 Problem Set 3: due 9/8/09 1 Data-flow Analysis Review Start at slide 21 of Basic Analysis 3 1 Static

More information

Syntax Analysis, VII The Canonical LR(1) Table Construction. Comp 412 COMP 412 FALL Chapter 3 in EaC2e. source code. IR IR target.

Syntax Analysis, VII The Canonical LR(1) Table Construction. Comp 412 COMP 412 FALL Chapter 3 in EaC2e. source code. IR IR target. COMP 412 FALL 2017 Syntax Analysis, VII The Canonical LR(1) Table Construction Comp 412 source code IR IR target Front End Optimizer Back End code Copyright 2017, Keith D. Cooper & Linda Torczon, all rights

More information

CSC D70: Compiler Optimization Static Single Assignment (SSA)

CSC D70: Compiler Optimization Static Single Assignment (SSA) CSC D70: Compiler Optimization Static Single Assignment (SSA) Prof. Gennady Pekhimenko University of Toronto Winter 08 The content of this lecture is adapted from the lectures of Todd Mowry and Phillip

More information

Material Covered on the Final

Material Covered on the Final Material Covered on the Final On the final exam, you are responsible for: Anything covered in class, except for stories about my good friend Ken Kennedy All lecture material after the midterm ( below the

More information

Syntax Analysis, VII The Canonical LR(1) Table Construction. Comp 412

Syntax Analysis, VII The Canonical LR(1) Table Construction. Comp 412 COMP 412 FALL 2018 Syntax Analysis, VII The Canonical LR(1) Table Construction Comp 412 source code IR IR target Front End Optimizer Back End code Copyright 2018, Keith D. Cooper & Linda Torczon, all rights

More information

Beyond Superlocal: Dominators, Data-Flow Analysis, and DVNT. COMP 506 Rice University Spring target code. source code OpJmizer

Beyond Superlocal: Dominators, Data-Flow Analysis, and DVNT. COMP 506 Rice University Spring target code. source code OpJmizer COMP 506 Rice University Spring 2017 Beyond Superlocal: Dominators, Data-Flow Analysis, and DVNT source code Front End IR OpJmizer IR Back End target code Copyright 2017, Keith D. Cooper & Linda Torczon,

More information

Syntax Analysis, VI Examples from LR Parsing. Comp 412

Syntax Analysis, VI Examples from LR Parsing. Comp 412 COMP 412 FALL 2017 Syntax Analysis, VI Examples from LR Parsing Comp 412 source code IR IR target code Front End Optimizer Back End Copyright 2017, Keith D. Cooper & Linda Torczon, all rights reserved.

More information

COSE312: Compilers. Lecture 17 Intermediate Representation (2)

COSE312: Compilers. Lecture 17 Intermediate Representation (2) COSE312: Compilers Lecture 17 Intermediate Representation (2) Hakjoo Oh 2017 Spring Hakjoo Oh COSE312 2017 Spring, Lecture 17 May 31, 2017 1 / 19 Common Intermediate Representations Three-address code

More information

Topics on Compilers

Topics on Compilers Assignment 2 4541.775 Topics on Compilers Sample Solution 1. Test for dependences on S. Write down the subscripts. Which positions are separable, which are coupled? Which dependence test would you apply

More information

MIT Loop Optimizations. Martin Rinard

MIT Loop Optimizations. Martin Rinard MIT 6.035 Loop Optimizations Martin Rinard Loop Optimizations Important because lots of computation occurs in loops We will study two optimizations Loop-invariant code motion Induction variable elimination

More information

Parsing VI LR(1) Parsers

Parsing VI LR(1) Parsers Parsing VI LR(1) Parsers N.B.: This lecture uses a left-recursive version of the SheepNoise grammar. The book uses a rightrecursive version. The derivations (& the tables) are different. Copyright 2005,

More information

Automata Theory CS S-12 Turing Machine Modifications

Automata Theory CS S-12 Turing Machine Modifications Automata Theory CS411-2015S-12 Turing Machine Modifications David Galles Department of Computer Science University of San Francisco 12-0: Extending Turing Machines When we added a stack to NFA to get a

More information

CS415 Compilers Syntax Analysis Bottom-up Parsing

CS415 Compilers Syntax Analysis Bottom-up Parsing CS415 Compilers Syntax Analysis Bottom-up Parsing These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University Review: LR(k) Shift-reduce Parsing Shift reduce

More information

CSE P 501 Compilers. Value Numbering & Op;miza;ons Hal Perkins Winter UW CSE P 501 Winter 2016 S-1

CSE P 501 Compilers. Value Numbering & Op;miza;ons Hal Perkins Winter UW CSE P 501 Winter 2016 S-1 CSE P 501 Compilers Value Numbering & Op;miza;ons Hal Perkins Winter 2016 UW CSE P 501 Winter 2016 S-1 Agenda Op;miza;on (Review) Goals Scope: local, superlocal, regional, global (intraprocedural), interprocedural

More information

Verifying the LLVM. Steve Zdancewic DeepSpec Summer School 2017

Verifying the LLVM. Steve Zdancewic DeepSpec Summer School 2017 Verifying the LLVM Steve Zdancewic DeepSpec Summer School 2017 Vminus OperaAonal SemanAcs Only 5 kinds of instrucaons: Binary arithmeac Memory Load Memory Store Terminators Phi nodes What is the state

More information

CS 553 Compiler Construction Fall 2006 Homework #2 Dominators, Loops, SSA, and Value Numbering

CS 553 Compiler Construction Fall 2006 Homework #2 Dominators, Loops, SSA, and Value Numbering CS 553 Compiler Construction Fall 2006 Homework #2 Dominators, Loops, SSA, and Value Numbering Answers Write your answers on another sheet of paper. Homework assignments are to be completed individually.

More information

Lexical Analysis Part II: Constructing a Scanner from Regular Expressions

Lexical Analysis Part II: Constructing a Scanner from Regular Expressions Lexical Analysis Part II: Constructing a Scanner from Regular Expressions CS434 Spring 2005 Department of Computer Science University of Alabama Joel Jones Copyright 2003, Keith D. Cooper, Ken Kennedy

More information

Models of Computation, Recall Register Machines. A register machine (sometimes abbreviated to RM) is specified by:

Models of Computation, Recall Register Machines. A register machine (sometimes abbreviated to RM) is specified by: Models of Computation, 2010 1 Definition Recall Register Machines A register machine (sometimes abbreviated M) is specified by: Slide 1 finitely many registers R 0, R 1,..., R n, each capable of storing

More information

Dataflow Analysis. A sample program int fib10(void) { int n = 10; int older = 0; int old = 1; Simple Constant Propagation

Dataflow Analysis. A sample program int fib10(void) { int n = 10; int older = 0; int old = 1; Simple Constant Propagation -74 Lecture 2 Dataflow Analysis Basic Blocks Related Optimizations SSA Copyright Seth Copen Goldstein 200-8 Dataflow Analysis Last time we looked at code transformations Constant propagation Copy propagation

More information

ECE 5775 (Fall 17) High-Level Digital Design Automation. Control Flow Graph

ECE 5775 (Fall 17) High-Level Digital Design Automation. Control Flow Graph ECE 5775 (Fall 17) High-Level Digital Design Automation Control Flow Graph Announcements ECE colloquium on Monday 9/11 from 4:30pm, PHL 233 Smart Healthcare by Prof. Niraj Jha of Princeton Lab 1 is due

More information

Turing Machines Part II

Turing Machines Part II Turing Machines Part II Hello Hello Condensed Slide Slide Readers! Readers! This This lecture lecture is is almost almost entirely entirely animations that that show show how how each each Turing Turing

More information

Syntactic Analysis. Top-Down Parsing

Syntactic Analysis. Top-Down Parsing Syntactic Analysis Top-Down Parsing Copyright 2015, Pedro C. Diniz, all rights reserved. Students enrolled in Compilers class at University of Southern California (USC) have explicit permission to make

More information

Algorithms for Computing the Static Single Assignment Form

Algorithms for Computing the Static Single Assignment Form Algorithms for Computing the Static Single Assignment Form GIANFRANCO BILARDI Università di Padova, Padova, Italy AND KESHAV PINGALI Cornell University, Ithaca, New York Abstract. The Static Single Assignment

More information

CMSC 631 Program Analysis and Understanding. Spring Data Flow Analysis

CMSC 631 Program Analysis and Understanding. Spring Data Flow Analysis CMSC 631 Program Analysis and Understanding Spring 2013 Data Flow Analysis Data Flow Analysis A framework for proving facts about programs Reasons about lots of little facts Little or no interaction between

More information

Classes of data dependence. Dependence analysis. Flow dependence (True dependence)

Classes of data dependence. Dependence analysis. Flow dependence (True dependence) Dependence analysis Classes of data dependence Pattern matching and replacement is all that is needed to apply many source-to-source transformations. For example, pattern matching can be used to determine

More information

Dependence analysis. However, it is often necessary to gather additional information to determine the correctness of a particular transformation.

Dependence analysis. However, it is often necessary to gather additional information to determine the correctness of a particular transformation. Dependence analysis Pattern matching and replacement is all that is needed to apply many source-to-source transformations. For example, pattern matching can be used to determine that the recursion removal

More information

Topic-I-C Dataflow Analysis

Topic-I-C Dataflow Analysis Topic-I-C Dataflow Analysis 2012/3/2 \course\cpeg421-08s\topic4-a.ppt 1 Global Dataflow Analysis Motivation We need to know variable def and use information between basic blocks for: constant folding dead-code

More information

Data flow analysis. DataFlow analysis

Data flow analysis. DataFlow analysis Data flow analysis DataFlow analysis compile time reasoning about the runtime flow of values in the program represent facts about runtime behavior represent effect of executing each basic block propagate

More information

Turing Machines Part II

Turing Machines Part II Turing Machines Part II Problem Set Set Five Five due due in in the the box box up up front front using using a late late day. day. Hello Hello Condensed Slide Slide Readers! Readers! This This lecture

More information

CSC D70: Compiler Optimization Dataflow-2 and Loops

CSC D70: Compiler Optimization Dataflow-2 and Loops CSC D70: Compiler Optimization Dataflow-2 and Loops Prof. Gennady Pekhimenko University of Toronto Winter 2018 The content of this lecture is adapted from the lectures of Todd Mowry and Phillip Gibbons

More information

Static Program Analysis

Static Program Analysis Static Program Analysis Xiangyu Zhang The slides are compiled from Alex Aiken s Michael D. Ernst s Sorin Lerner s A Scary Outline Type-based analysis Data-flow analysis Abstract interpretation Theorem

More information

CS415 Compilers Syntax Analysis Top-down Parsing

CS415 Compilers Syntax Analysis Top-down Parsing CS415 Compilers Syntax Analysis Top-down Parsing These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University Announcements Midterm on Thursday, March 13

More information

AMORTIZED ANALYSIS. binary counter multipop stack dynamic table. Lecture slides by Kevin Wayne. Last updated on 1/24/17 11:31 AM

AMORTIZED ANALYSIS. binary counter multipop stack dynamic table. Lecture slides by Kevin Wayne. Last updated on 1/24/17 11:31 AM AMORTIZED ANALYSIS binary counter multipop stack dynamic table Lecture slides by Kevin Wayne http://www.cs.princeton.edu/~wayne/kleinberg-tardos Last updated on 1/24/17 11:31 AM Amortized analysis Worst-case

More information

Space-aware data flow analysis

Space-aware data flow analysis Space-aware data flow analysis C. Bernardeschi, G. Lettieri, L. Martini, P. Masci Dip. di Ingegneria dell Informazione, Università di Pisa, Via Diotisalvi 2, 56126 Pisa, Italy {cinzia,g.lettieri,luca.martini,paolo.masci}@iet.unipi.it

More information

CS20a: Turing Machines (Oct 29, 2002)

CS20a: Turing Machines (Oct 29, 2002) CS20a: Turing Machines (Oct 29, 2002) So far: DFA = regular languages PDA = context-free languages Today: Computability 1 Church s thesis The computable functions are the same as the partial recursive

More information

Lecture 7: Amortized analysis

Lecture 7: Amortized analysis Lecture 7: Amortized analysis In many applications we want to minimize the time for a sequence of operations. To sum worst-case times for single operations can be overly pessimistic, since it ignores correlation

More information

Ma 322 Spring Ma 322. Jan 18, 20

Ma 322 Spring Ma 322. Jan 18, 20 Ma 322 Spring 2017 Ma 322 Jan 18, 20 Summary ˆ Review of the Standard Gauss Elimination Algorithm: REF+ Backsub ˆ The rank of a matrix. ˆ Vectors and Linear combinations. ˆ Span of a set of vectors. ˆ

More information

Compiler Design. Data Flow Analysis. Hwansoo Han

Compiler Design. Data Flow Analysis. Hwansoo Han Compiler Design Data Flow Analysis Hwansoo Han Control Flow Graph What is CFG? Represents program structure for internal use of compilers Used in various program analyses Generated from AST or a sequential

More information

Saturday, April 23, Dependence Analysis

Saturday, April 23, Dependence Analysis Dependence Analysis Motivating question Can the loops on the right be run in parallel? i.e., can different processors run different iterations in parallel? What needs to be true for a loop to be parallelizable?

More information

Syntax Analysis Part I

Syntax Analysis Part I 1 Syntax Analysis Part I Chapter 4 COP5621 Compiler Construction Copyright Robert van Engelen, Florida State University, 2007-2013 2 Position of a Parser in the Compiler Model Source Program Lexical Analyzer

More information

Speculative Parallelism in Cilk++

Speculative Parallelism in Cilk++ Speculative Parallelism in Cilk++ Ruben Perez & Gregory Malecha MIT May 11, 2010 Ruben Perez & Gregory Malecha (MIT) Speculative Parallelism in Cilk++ May 11, 2010 1 / 33 Parallelizing Embarrassingly Parallel

More information

CS20a: Turing Machines (Oct 29, 2002)

CS20a: Turing Machines (Oct 29, 2002) CS20a: Turing Machines (Oct 29, 2002) So far: DFA = regular languages PDA = context-free languages Today: Computability 1 Handicapped machines DFA limitations Tape head moves only one direction 2-way DFA

More information

Lecture 5 Introduction to Data Flow Analysis

Lecture 5 Introduction to Data Flow Analysis Lecture 5 Introduction to Data Flow Analysis I. Structure of data flow analysis II. III. IV. Example 1: Reaching definition analysis Example 2: Liveness analysis Framework Phillip B. Gibbons 15-745: Intro

More information

Chapter 4: Computation tree logic

Chapter 4: Computation tree logic INFOF412 Formal verification of computer systems Chapter 4: Computation tree logic Mickael Randour Formal Methods and Verification group Computer Science Department, ULB March 2017 1 CTL: a specification

More information

Chapter 3 Deterministic planning

Chapter 3 Deterministic planning Chapter 3 Deterministic planning In this chapter we describe a number of algorithms for solving the historically most important and most basic type of planning problem. Two rather strong simplifying assumptions

More information

Verification of Recursive Programs. Andreas Podelski February 8, 2012

Verification of Recursive Programs. Andreas Podelski February 8, 2012 Verification of Recursive Programs Andreas Podelski February 8, 2012 1 m(x) = x 10 if x > 100 m(m(x + 11)) if x 100 2 procedure m(x) returns (res) `0: if x>100 `1: res:=x-10 else `2: x m := x+11 `3: res

More information

Lecture 3: Reductions and Completeness

Lecture 3: Reductions and Completeness CS 710: Complexity Theory 9/13/2011 Lecture 3: Reductions and Completeness Instructor: Dieter van Melkebeek Scribe: Brian Nixon Last lecture we introduced the notion of a universal Turing machine for deterministic

More information

(b). Identify all basic blocks in your three address code. B1: 1; B2: 2; B3: 3,4,5,6; B4: 7,8,9; B5: 10; B6: 11; B7: 12,13,14; B8: 15;

(b). Identify all basic blocks in your three address code. B1: 1; B2: 2; B3: 3,4,5,6; B4: 7,8,9; B5: 10; B6: 11; B7: 12,13,14; B8: 15; (a). Translate the program into three address code as defined in Section 6.2, dragon book. (1) i := 2 (2) if i > n goto (7) (3) a[i] := TRUE (4) t2 := i+1 (5) i := t2 (6) goto (2) (7) count := 0 (8) s

More information

ECE 5775 (Fall 17) High-Level Digital Design Automation. Scheduling: Exact Methods

ECE 5775 (Fall 17) High-Level Digital Design Automation. Scheduling: Exact Methods ECE 5775 (Fall 17) High-Level Digital Design Automation Scheduling: Exact Methods Announcements Sign up for the first student-led discussions today One slot remaining Presenters for the 1st session will

More information

Dataflow Analysis - 2. Monotone Dataflow Frameworks

Dataflow Analysis - 2. Monotone Dataflow Frameworks Dataflow Analysis - 2 Monotone dataflow frameworks Definition Convergence Safety Relation of MOP to MFP Constant propagation Categorization of dataflow problems DataflowAnalysis 2, Sp06 BGRyder 1 Monotone

More information

LR(1) Parsers Part III Last Parsing Lecture. Copyright 2010, Keith D. Cooper & Linda Torczon, all rights reserved.

LR(1) Parsers Part III Last Parsing Lecture. Copyright 2010, Keith D. Cooper & Linda Torczon, all rights reserved. LR(1) Parsers Part III Last Parsing Lecture Copyright 2010, Keith D. Cooper & Linda Torczon, all rights reserved. LR(1) Parsers A table-driven LR(1) parser looks like source code Scanner Table-driven Parser

More information

CSE 200 Lecture Notes Turing machine vs. RAM machine vs. circuits

CSE 200 Lecture Notes Turing machine vs. RAM machine vs. circuits CSE 200 Lecture Notes Turing machine vs. RAM machine vs. circuits Chris Calabro January 13, 2016 1 RAM model There are many possible, roughly equivalent RAM models. Below we will define one in the fashion

More information

Lecture 3. 1 Terminology. 2 Non-Deterministic Space Complexity. Notes on Complexity Theory: Fall 2005 Last updated: September, 2005.

Lecture 3. 1 Terminology. 2 Non-Deterministic Space Complexity. Notes on Complexity Theory: Fall 2005 Last updated: September, 2005. Notes on Complexity Theory: Fall 2005 Last updated: September, 2005 Jonathan Katz Lecture 3 1 Terminology For any complexity class C, we define the class coc as follows: coc def = { L L C }. One class

More information

MIT Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology

MIT Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology MIT 6.035 Foundations of Dataflow Analysis Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology Dataflow Analysis Compile-Time Reasoning About Run-Time Values of Variables

More information

Lexical Analysis. DFA Minimization & Equivalence to Regular Expressions

Lexical Analysis. DFA Minimization & Equivalence to Regular Expressions Lexical Analysis DFA Minimization & Equivalence to Regular Expressions Copyright 26, Pedro C. Diniz, all rights reserved. Students enrolled in the Compilers class at the University of Southern California

More information

6.841/18.405J: Advanced Complexity Wednesday, February 12, Lecture Lecture 3

6.841/18.405J: Advanced Complexity Wednesday, February 12, Lecture Lecture 3 6.841/18.405J: Advanced Complexity Wednesday, February 12, 2003 Lecture Lecture 3 Instructor: Madhu Sudan Scribe: Bobby Kleinberg 1 The language MinDNF At the end of the last lecture, we introduced the

More information

A call-by-name lambda-calculus machine

A call-by-name lambda-calculus machine A call-by-name lambda-calculus machine Jean-Louis Krivine University Paris VII, C.N.R.S. 2 place Jussieu 75251 Paris cedex 05 (krivine@pps.jussieu.fr) Introduction We present, in this paper, a particularly

More information

Solutions. Problem 1: Suppose a polynomial in n of degree d has the form

Solutions. Problem 1: Suppose a polynomial in n of degree d has the form Assignment 1 1. Problem 3-1 on p. 57 2. Problem 3-2 on p. 58 3. Problem 4-5 on p. 86 4. Problem 6-1 on p. 142 5. Problem 7-4 on p. 162 6. Prove correctness (including halting) of SelectionSort (use loop

More information

Computational Models Lecture 8 1

Computational Models Lecture 8 1 Computational Models Lecture 8 1 Handout Mode Ronitt Rubinfeld and Iftach Haitner. Tel Aviv University. May 11/13, 2015 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice

More information

Designing Information Devices and Systems I Spring 2018 Lecture Notes Note Introduction to Linear Algebra the EECS Way

Designing Information Devices and Systems I Spring 2018 Lecture Notes Note Introduction to Linear Algebra the EECS Way EECS 16A Designing Information Devices and Systems I Spring 018 Lecture Notes Note 1 1.1 Introduction to Linear Algebra the EECS Way In this note, we will teach the basics of linear algebra and relate

More information

Polynomial Space. The classes PS and NPS Relationship to Other Classes Equivalence PS = NPS A PS-Complete Problem

Polynomial Space. The classes PS and NPS Relationship to Other Classes Equivalence PS = NPS A PS-Complete Problem Polynomial Space The classes PS and NPS Relationship to Other Classes Equivalence PS = NPS A PS-Complete Problem 1 Polynomial-Space-Bounded TM s A TM M is said to be polyspacebounded if there is a polynomial

More information

Module 1: Analyzing the Efficiency of Algorithms

Module 1: Analyzing the Efficiency of Algorithms Module 1: Analyzing the Efficiency of Algorithms Dr. Natarajan Meghanathan Professor of Computer Science Jackson State University Jackson, MS 39217 E-mail: natarajan.meghanathan@jsums.edu What is an Algorithm?

More information

California Common Core State Standards for Mathematics Standards Map Mathematics I

California Common Core State Standards for Mathematics Standards Map Mathematics I A Correlation of Pearson Integrated High School Mathematics Mathematics I Common Core, 2014 to the California Common Core State s for Mathematics s Map Mathematics I Copyright 2017 Pearson Education, Inc.

More information

Safety Analysis versus Type Inference

Safety Analysis versus Type Inference Information and Computation, 118(1):128 141, 1995. Safety Analysis versus Type Inference Jens Palsberg palsberg@daimi.aau.dk Michael I. Schwartzbach mis@daimi.aau.dk Computer Science Department, Aarhus

More information

Scalar Optimisation Part 1

Scalar Optimisation Part 1 calar Optimisation Part 1 Michael O Boyle January, 2014 1 Course tructure L1 Introduction and Recap 4/5 lectures on classical optimisation 2 lectures on scalar optimisation Today example optimisations

More information

Dataflow analysis. Theory and Applications. cs6463 1

Dataflow analysis. Theory and Applications. cs6463 1 Dataflow analysis Theory and Applications cs6463 1 Control-flow graph Graphical representation of runtime control-flow paths Nodes of graph: basic blocks (straight-line computations) Edges of graph: flows

More information

Syntax Analysis Part I. Position of a Parser in the Compiler Model. The Parser. Chapter 4

Syntax Analysis Part I. Position of a Parser in the Compiler Model. The Parser. Chapter 4 1 Syntax Analysis Part I Chapter 4 COP5621 Compiler Construction Copyright Robert van ngelen, Flora State University, 2007 Position of a Parser in the Compiler Model 2 Source Program Lexical Analyzer Lexical

More information

Algorithms and Data Structures

Algorithms and Data Structures Algorithms and Data Structures Amortized Analysis Ulf Leser Two Examples Two Analysis Methods Dynamic Tables SOL - Analysis This lecture is not covered in [OW93] but, for instance, in [Cor03] Ulf Leser:

More information

(a) Definition of TMs. First Problem of URMs

(a) Definition of TMs. First Problem of URMs Sec. 4: Turing Machines First Problem of URMs (a) Definition of the Turing Machine. (b) URM computable functions are Turing computable. (c) Undecidability of the Turing Halting Problem That incrementing

More information

Automata Theory (2A) Young Won Lim 5/31/18

Automata Theory (2A) Young Won Lim 5/31/18 Automata Theory (2A) Copyright (c) 2018 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

More Dynamic Programming

More Dynamic Programming CS 374: Algorithms & Models of Computation, Spring 2017 More Dynamic Programming Lecture 14 March 9, 2017 Chandra Chekuri (UIUC) CS374 1 Spring 2017 1 / 42 What is the running time of the following? Consider

More information

Dataflow Analysis. Chapter 9, Section 9.2, 9.3, 9.4

Dataflow Analysis. Chapter 9, Section 9.2, 9.3, 9.4 Dataflow Analysis Chapter 9, Section 9.2, 9.3, 9.4 2 Dataflow Analysis Dataflow analysis is a sub area of static program analysis Used in the compiler back end for optimizations of three address code and

More information

CS 6820 Fall 2014 Lectures, October 3-20, 2014

CS 6820 Fall 2014 Lectures, October 3-20, 2014 Analysis of Algorithms Linear Programming Notes CS 6820 Fall 2014 Lectures, October 3-20, 2014 1 Linear programming The linear programming (LP) problem is the following optimization problem. We are given

More information

Alpha-Beta Pruning: Algorithm and Analysis

Alpha-Beta Pruning: Algorithm and Analysis Alpha-Beta Pruning: Algorithm and Analysis Tsan-sheng Hsu tshsu@iis.sinica.edu.tw http://www.iis.sinica.edu.tw/~tshsu 1 Introduction Alpha-beta pruning is the standard searching procedure used for 2-person

More information

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Dynamic Programming II Date: 10/12/17

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Dynamic Programming II Date: 10/12/17 601.433/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Dynamic Programming II Date: 10/12/17 12.1 Introduction Today we re going to do a couple more examples of dynamic programming. While

More information

CSCE 551: Chin-Tser Huang. University of South Carolina

CSCE 551: Chin-Tser Huang. University of South Carolina CSCE 551: Theory of Computation Chin-Tser Huang huangct@cse.sc.edu University of South Carolina Church-Turing Thesis The definition of the algorithm came in the 1936 papers of Alonzo Church h and Alan

More information

Alpha-Beta Pruning: Algorithm and Analysis

Alpha-Beta Pruning: Algorithm and Analysis Alpha-Beta Pruning: Algorithm and Analysis Tsan-sheng Hsu tshsu@iis.sinica.edu.tw http://www.iis.sinica.edu.tw/~tshsu 1 Introduction Alpha-beta pruning is the standard searching procedure used for solving

More information

CSE 241 Class 1. Jeremy Buhler. August 24,

CSE 241 Class 1. Jeremy Buhler. August 24, CSE 41 Class 1 Jeremy Buhler August 4, 015 Before class, write URL on board: http://classes.engineering.wustl.edu/cse41/. Also: Jeremy Buhler, Office: Jolley 506, 314-935-6180 1 Welcome and Introduction

More information

Lecture Notes on Inductive Definitions

Lecture Notes on Inductive Definitions Lecture Notes on Inductive Definitions 15-312: Foundations of Programming Languages Frank Pfenning Lecture 2 August 28, 2003 These supplementary notes review the notion of an inductive definition and give

More information

Nested Interpolants. Matthias Heizmann Jochen Hoenicke Andreas Podelski. Abstract. 1. Introduction. University of Freiburg, Germany

Nested Interpolants. Matthias Heizmann Jochen Hoenicke Andreas Podelski. Abstract. 1. Introduction. University of Freiburg, Germany c ACM 2010. This is the author s version of the work. t is posted here by permission of ACM for your personal use. Not for redistribution. The definitive version was published in Principles of Programming

More information

Amortized Analysis (chap. 17)

Amortized Analysis (chap. 17) Amortized Analysis (chap. 17) Not just consider one operation, but a sequence of operations on a given data structure. Average cost over a sequence of operations. Probabilistic analysis: Average case running

More information

Static and Kinetic Friction

Static and Kinetic Friction Experiment Static and Kinetic Friction Prelab Questions 1. Examine the Force vs. time graph and the Position vs. time graph below. The horizontal time scales are the same. In Region I, explain how an object

More information

Worst-Case Execution Time Analysis. LS 12, TU Dortmund

Worst-Case Execution Time Analysis. LS 12, TU Dortmund Worst-Case Execution Time Analysis Prof. Dr. Jian-Jia Chen LS 12, TU Dortmund 02, 03 May 2016 Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 1 / 53 Most Essential Assumptions for Real-Time Systems Upper

More information

Universal Turing Machine. Lecture 20

Universal Turing Machine. Lecture 20 Universal Turing Machine Lecture 20 1 Turing Machine move the head left or right by one cell read write sequentially accessed infinite memory finite memory (state) next-action look-up table Variants don

More information

Software Verification

Software Verification Software Verification Grégoire Sutre LaBRI, University of Bordeaux, CNRS, France Summer School on Verification Technology, Systems & Applications September 2008 Grégoire Sutre Software Verification VTSA

More information

Alpha-Beta Pruning: Algorithm and Analysis

Alpha-Beta Pruning: Algorithm and Analysis Alpha-Beta Pruning: Algorithm and Analysis Tsan-sheng Hsu tshsu@iis.sinica.edu.tw http://www.iis.sinica.edu.tw/~tshsu 1 Introduction Alpha-beta pruning is the standard searching procedure used for 2-person

More information

Unit 0. Unit 1. OUHSD Mathematics Pacing Guide. OUHSD Mathematics Pacing Guide. Total Days 15. Total Days 23. Unit 0: Bridge to Math 1.

Unit 0. Unit 1. OUHSD Mathematics Pacing Guide. OUHSD Mathematics Pacing Guide. Total Days 15. Total Days 23. Unit 0: Bridge to Math 1. OUHSD Mathematics Pacing Guide Quarter 1 Unit 0: Bridge to Unit 0 Total Days 15 Cluster Heading Standard MVP "REVIEW: Use own Resources Solving Equations: One- step; Two- step; Multi- step; Variables on

More information

A Decidable Class of Planar Linear Hybrid Systems

A Decidable Class of Planar Linear Hybrid Systems A Decidable Class of Planar Linear Hybrid Systems Pavithra Prabhakar, Vladimeros Vladimerou, Mahesh Viswanathan, and Geir E. Dullerud University of Illinois at Urbana-Champaign. Abstract. The paper shows

More information

Computational Models Lecture 8 1

Computational Models Lecture 8 1 Computational Models Lecture 8 1 Handout Mode Ronitt Rubinfeld and Iftach Haitner. Tel Aviv University. April 18/ May 2, 2016 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice

More information

Static Analysis of Programs: A Heap-Centric View

Static Analysis of Programs: A Heap-Centric View Static Analysis of Programs: A Heap-Centric View (www.cse.iitb.ac.in/ uday) Department of Computer Science and Engineering, Indian Institute of Technology, Bombay 5 April 2008 Part 1 Introduction ETAPS

More information

Data Structures for Disjoint Sets

Data Structures for Disjoint Sets Data Structures for Disjoint Sets Advanced Data Structures and Algorithms (CLRS, Chapter 2) James Worrell Oxford University Computing Laboratory, UK HT 200 Disjoint-set data structures Also known as union

More information

Tute 10. Liam O'Connor. May 23, 2017

Tute 10. Liam O'Connor. May 23, 2017 Tute 10 Liam O'Connor May 23, 2017 proc Search(value g : G, value s : V g, value k : K, result v : T, result f : B) Where a graph g : G is dened as a 4-tuple (V, Γ, κ, λ) containing a set of vertices V,

More information

Introduction to Computing II (ITI1121) FINAL EXAMINATION

Introduction to Computing II (ITI1121) FINAL EXAMINATION Université d Ottawa Faculté de génie École de science informatique et de génie électrique University of Ottawa Faculty of engineering School of Electrical Engineering and Computer Science Identification

More information

On the Exponent of the All Pairs Shortest Path Problem

On the Exponent of the All Pairs Shortest Path Problem On the Exponent of the All Pairs Shortest Path Problem Noga Alon Department of Mathematics Sackler Faculty of Exact Sciences Tel Aviv University Zvi Galil Department of Computer Science Sackler Faculty

More information