Skip to main content

Module post_dominator_tree

Module post_dominator_tree 

Source
Expand description

A post-dominator tree for a single function.

The post-dominator tree is the dual of the DominatorTree: it answers whether every path from a block to a function exit (a return, trap, etc.) must pass through some other block.

It is computed by reusing the ordinary dominator-tree machinery on a modified version of the control-flow graph:

  • Add a virtual sink node.

  • Every block whose terminator does not branch anywhere (return, return_call, trap, etc.) is given an edge to the virtual sink.

  • Reverse every edge in the graph, so a -> b becomes b -> a.

  • Compute the dominator tree of this reversed graph, rooted at the virtual sink.

Note that we don’t actually reify this modified version of the control-flow graph, we instead use the ReverseGraph implementation of the DomTreeGraph trait.

Structs§

PostDominatorTree
The post-dominator tree for a single function.