22 - Interprocedural Analysis Dealing with Procedures...

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

View Full Document Right Arrow Icon
Interprocedural Analysis Course so far: Control Flow Representation Datafow Representation SSA ±orm Classic De±Use and UseDe± Chains Optimizations Scheduling Register Allocation Just-In-Time Compilation GC Alias analysis All o± these have been ±or an individual procedure - intraprocedural analysis. Today: Interprocedural analysis (across/between procedures) Brie± 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 ±ormals and/or globals may be aliased (two names re±er to same location) ±ormals may have constant value At procedure call global vars may be modi²ed or used actual args may be modi²ed or used Conservative assumptions for procedures may signiFcantly inhibit optimization CS 380C Lecture 22 2 Interprocedural Analysis
Background image of page 1

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

View Full DocumentRight Arrow Icon
Dealing with Procedures Aliasing example int a foo(a, a) ... procedure foo(var b, c) a:=1 //whatisb,c? b:=2 //whatisa,c? c:=3 //whatisa,b? d:=a+b //whatisd? end Side efect example foo(a) // what is used/killed? b:=a //whatisb? 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 DeFniteness May captures possibility optimizations “must account for” Must captures certainty optimizations “may rely on” ±low sensitivity Sensitive (consider control Fow) Determine value for each program point Requires data-Fow analysis Precise Insensitive (ignore control Fow) Determine value for whole procedure Can compute in linear time Imprecise CS 380C Lecture 22 4 Interprocedural Analysis
Background image of page 2
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 :P roc edu r ebod yandp r eca l l 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. Bene±ts 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.
Background image of page 3

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

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

This note was uploaded on 03/09/2012 for the course CS 380 taught by Professor Shmat during the Fall '08 term at University of Texas.

Page1 / 13

22 - Interprocedural Analysis Dealing with Procedures...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online