Download presentation
Presentation is loading. Please wait.
1
From last class
2
The above is Click’s solution (PLDI 95)
4
Control Dependences A node (basic block) Y is control-dependent on another X iff X determines whether Y executes –there exists a path from X to Y s.t. every node in the path other than X and Y is post-dominated by Y –X is not post-dominated by Y
5
Control Dependences A node (basic block) Y is control-dependent on another X iff X determines whether Y executes –there exists a path from X to Y s.t. every node in the path other than X and Y is post-dominated by Y –X is not post-dominated by Y
6
Example
8
Control Dependence Graph Control dependence graph: Y decsendent of X iff Y is control dependent on Y –label each child edge with required condition –group all children with same condition under region node Program dependence graph: super-impose dataflow graph (in SSA form or not) on top of the control dependence graph
9
Example
11
Another example
15
Summary so far Dataflow analysis –flow functions, lattice theoretic framework, optimistic iterative analysis, MOP Rhodium/Collider –declarative specifications of flow functions Advanced Program Representations –SSA, CDG, PDG, code motion Next: dealing with procedures
16
After that Pointer analysis Program analysis for verification Correctness Analyzing object-oriented languages Advanced topics (set constraints, ordering analyses and transformations, gc)
17
Interprocedural analyses and optimizations
18
Costs of procedure calls Up until now, we treated calls conservatively: –make the flow function for call nodes return top –start iterative analysis with incoming edge of the CFG set to top –This leads to less precise results: “lost-precision” cost Calls also incur a direct runtime cost –cost of call, return, argument & result passing, stack frame maintainance –“direct runtime” cost
19
Addressing costs of procedure calls Technique 1: try to get rid of calls, using inlining and other techniques Technique 2: interprocedural analysis, for calls that are left
20
Inlining Replace call with body of callee Turn parameter- and result-passing into assignments –do copy prop to eliminate copies Manage variable scoping correctly –rename variables where appropriate
21
Program representation for inlining Call graph –nodes are procedures –edges are calls, labelled by invocation counts/frequency Hard cases for builing call graph –calls to/from external routines –calls through pointers, function values, messages Where in the compiler should inlining be performed?
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.