# 22 - Interprocedural Analysis Dealing with Procedures...

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

Interprocedural Analysis Course so far: Control Flow Representation Dataflow Representation SSA form Classic DefUse and UseDef Chains Optimizations Scheduling Register Allocation Just-In-Time Compilation GC Alias analysis All of these have been for an individual procedure - intraprocedural analysis. Today: Interprocedural analysis (across/between procedures) Brief overview CS 380C Lecture 22 1 Interprocedural Analysis Dealing with Procedures Terminology int a, e // globals procedure foo(var b, c) // formal args b := c end program main int d // locals foo(a, d) // call site with end // actual args In procedure body formals and/or globals may be aliased (two names refer to same location) formals may have constant value At procedure call global vars may be modified or used actual args may be modified or used Conservative assumptions for procedures may significantly inhibit optimization CS 380C Lecture 22 2 Interprocedural Analysis

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

View Full Document
Dealing with Procedures Aliasing example int a foo(a, a) ... procedure foo(var b, c) a := 1 // what is b, c? b := 2 // what is a, c? c := 3 // what is a, b? d := a + b // what is d? end Side e ff ect example a := 1 foo(a) // what is used/killed? b := a // what is b? Constants example foo(1) ... procedure foo(a) if (a = 1) // what is a’s value? ... CS 380C Lecture 22 3 Interprocedural Analysis Characterizing an Analysis Definiteness May captures possibility optimizations “must account for” Must captures certainty optimizations “may rely on” Flow sensitivity Sensitive (consider control flow) Determine value for each program point Requires data-flow analysis Precise Insensitive (ignore control flow) Determine value for whole procedure Can compute in linear time Imprecise CS 380C Lecture 22 4 Interprocedural Analysis
Characterizing an Analysis Context sensitivity Sensitive (aka polyvariant analysis ) Determine values for each calling context Must re-analyze callee for each caller Insensitive (aka monovariant analysis ) Summarize values for all calling contexts Cheap(ish) but imprecise Recall : Procedure body and procedure call int a, b, c; main() s1: f(a); s2: f(b); foo(x) c = x; return; CS 380C Lecture 22 5 Interprocedural Analysis Why don’t many compilers use IP analysis? Inlining - poor woman’s interprocedural analysis. Is inlining an alternative, or is it part of IP analysis and transformation? Separate compilation with IP analysis requires recompilation analysis . IP analysis can be expensive. e.g., Flow-sensitive kill is intractable. Benefits of IP analysis on optimization have not been well explored, especially for scalar machines. Constants: Grove/Torczon’93, Metzer/Stoud’93 Dependence analysis: Paek et al.’98 Li et al.‘90, Havlak/Kennedy’90 Parallelizing Compilers: Hall et al.’95, McKinley’93 It is hard – solutions can be complex.

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 ]}

### What students are saying

• 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.

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

• 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.

Dana University of Pennsylvania ‘17, Course Hero Intern

• 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.

Jill Tulane University ‘16, Course Hero Intern