{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

slides6 - Principles of Program Analysis Algorithms...

Info icon This preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Principles of Program Analysis: Algorithms Transparencies based on Chapter 6 of the book: Flemming Nielson, Hanne Riis Nielson and Chris Hankin: Principles of Program Analysis . Springer Verlag 2005. c Flemming Nielson & Hanne Riis Nielson & Chris Hankin. PPA Chapter 6 c F.Nielson & H.Riis Nielson & C.Hankin (Dec. 2004) 1
Image of page 1

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

View Full Document Right Arrow Icon
Worklist Algorithms We abstract away from the details of a particular analysis: We want to compute the solution to a set of equations { x 1 = t 1 , · · · , x N = t N } or inequations { x 1 t 1 , · · · , x N t N } defined in terms of a set of flow variables x 1 , · · · , x N ; here t 1 , · · · , t N are terms using the flow variables. PPA Section 6.1 c F.Nielson & H.Riis Nielson & C.Hankin (Dec. 2004) 2
Image of page 2
Equations or inequations? It does not really matter: A solution of the equation system { x 1 = t 1 , · · · , x N = t N } is also a solution of the inequation system { x 1 t 1 , · · · , x N t N } The least solution to the inequation systems { x 1 t 1 , · · · , x N t N } is also a solution to the equation system { x 1 = t 1 , · · · , x N = t N } The inequation system { x t 1 , · · · , x t n } (same left hand sides) and the equation { x = x t 1 · · · t n } have the same solutions. The least solution to the equation { x = x t 1 · · · t n } is also the least solution of { x = t 1 · · · t n } (where the x com- ponent has been removed on the right hand side). PPA Section 6.1 c F.Nielson & H.Riis Nielson & C.Hankin (Dec. 2004) 3
Image of page 3

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

View Full Document Right Arrow Icon
Example While program Reaching Definitions Analysis of if [ b 1 ] 1 then (while [ b 2 ] 2 do [ x := a 1 ] 3 ) else (while [ b 3 ] 4 do [ x := a 2 ] 5 ); [ x := a 3 ] 6 gives equations of the form RD entry (1) = X ? RD exit (1) = RD entry (1) RD entry (2) = RD exit (1) RD exit (3) RD exit (2) = RD entry (2) RD entry (3) = RD exit (2) RD exit (3) = ( RD entry (3) \ X 356? ) X 3 RD entry (4) = RD exit (1) RD exit (5) RD exit (4) = RD entry (4) RD entry (5) = RD exit (4) RD exit (5) = ( RD entry (5) \ X 356? ) X 5 RD entry (6) = RD exit (2) RD exit (4) RD exit (6) = ( RD entry (6) \ X 356? ) X 6 where e.g. X 356? denotes the definitions of x at labels 3, 5, 6 and ? PPA Section 6.1 c F.Nielson & H.Riis Nielson & C.Hankin (Dec. 2004) 4
Image of page 4
Example (cont.) Focussing on RD entry and expressed as equations using the flow variables { x 1 , · · · , x 6 } : x 1 = X ? x 2 = x 1 ( x 3 \ X 356? ) X 3 x 3 = x 2 x 4 = x 1 ( x 5 \ X 356? ) X 5 x 5 = x 4 x 6 = x 2 x 4 Alternatively we can use inequations : x 1 X ? x 2 x 1 x 2 x 3 \ X 356? x 2 X 3 x 3 x 2 x 4 x 1 x 4 x 5 \ X 356? x 4 X 5 x 5 x 4 x 6 x 2 x 6 x 4 PPA Section 6.1 c F.Nielson & H.Riis Nielson & C.Hankin (Dec. 2004) 5
Image of page 5

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

View Full Document Right Arrow Icon
Assumptions There is a finite constraint system S of the form ( x i t i ) N i =1 for N 1 where the left hand sides x i are not necessarily distinct; the form of the terms t i of the right hand sides is left unspecified. The set FV ( t i ) of flow variables occurring in t i is a subset of the finite set X = { x i | 1 i N } .
Image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern