dominators
play

Dominators Definition In a CFG, node a dominates b if every path - PowerPoint PPT Presentation

Dominators Definition In a CFG, node a dominates b if every path from the start node to b passes through a . Node a is a dominator of b . Property The dominance relation is a partial order. Definition Node a strictly dominates b if a 6 = b and a


  1. Dominators Definition In a CFG, node a dominates b if every path from the start node to b passes through a . Node a is a dominator of b . Property The dominance relation is a partial order. Definition Node a strictly dominates b if a 6 = b and a dominates b .

  2. Dominators Theorem IF a and b both dominate c , THEN either a dominates b or b dominates a .

  3. Dominators Theorem IF a and b both dominate c , THEN either a dominates b or b dominates a . Corollary Every node n has at most one immediate dominator idom( n ) such that idom( n ) 6 = n idom( n ) dominates n , and idom( n ) does not dominate any other dominator of n .

  4. Dominator Example

  5. Computing Dominators As a dataflow analysis Forwards 1 Lattice is ( P ( Stmts ) , ◆ ) 2 \ 3 out ` = in ` [ { ` } 4 start node value is {} 5 ? = { all statements } 6

  6. Computing Dominators As a dataflow analysis Forwards 1 Lattice is ( P ( Stmts ) , ◆ ) 2 \ 3 out ` = in ` [ { ` } 4 start node value is {} 5 ? = { all statements } 6 More e ffi cient approaches Lengauer-Tarjan: see Appel book section 19.2 Cooper, Harvey, Kennedy: http://www.hipersoft.rice.edu/grads/ publications/dom14.pdf

  7. Dominance Frontier Definition A node w is in the dominance frontier of x if: x does not strictly dominate w , and x dominates a predecessor of w .

  8. Computing Dominance Frontier DF local ( x ): the successors of x not strictly dominated by x . DF up ( y ): nodes in DF ( y ) not strictly dominated by idom( y ). DF ( x ) = DF local ( x ) [ S { y | idom( y )= x } DF up ( y ).

  9. Computing Dominance Frontier Algorithm DF (x): 1: S = {} 2: for all nodes w 2 succ( x ) do if idom( w ) 6 = x then 3: S [ = { w } 4: 5: /* S is now DF local ( x ) */ 6: for all nodes y for which idom( y ) = x do /* below we compute DF up ( y ) */ 7: for all nodes w 2 DF ( y ) do 8: if x does not dominate w or x = w then 9: S [ = { w } 10: 11: return S

  10. Computing Dominance Frontier (Alternative) Restatement of definition of DF w 2 DF ( x ) for every x that dominates a predecessor of w , but does not strictly dominate w . Algorithm Compute DFs (): 1: for all nodes w do for all p 2 preds( w ) do 2: x = p 3: while x 6 = idom( w ) do 4: DF ( x ) [ = { w } 5: x = idom( x ) 6:

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend