# Software Analysis Midterm ###### tags: `class` ## Augmented Control Flow Graph Add start, entry and exit, where start is the parent of entry and exit ## Dominant tree and post dominant tree - Dominator tree: start from entry - Post dominator tree: start from exit ![](https://i.imgur.com/uCtcGY3.png) ## Control dependece graph https://collab.its.virginia.edu/access/content/group/f7c3f065-5457-4a72-a314-d7209736a27b/Solutions%20to%20assignments/problem4%20-soln.pdf 1. augment CDG 1. find S, a set of edges (A,B) in ACFG such that B is not an ancestor in PDT 2. for each edge (A,B) in S, find L, the least common ancestor of A and B in PDT 3. consider each edge (A,B) in S and its corresponding L. Traverse backwards in the PDT from B to L, marking each node visited; mark L only if L = A 4. Statements representing all marked nodes are control dependent on A with the label that is on the edge (A,B). ## program slicing http://www.cs.cmu.edu/afs/cs/academic/class/17654-f01/www/lecture/14.pdf ![](https://i.imgur.com/4eyd51E.png) ![](https://i.imgur.com/lh12S2D.png) ![](https://i.imgur.com/94aUWy2.png) ![](https://i.imgur.com/QmQPK6r.png) ![](https://i.imgur.com/02Jfgmu.png) ![](https://i.imgur.com/PYGycif.png) ## SDG Enter functionname copy the parameters and return value ![](https://i.imgur.com/LDch0V3.png) ![](https://i.imgur.com/j1iHQkU.png)