generateCallGraphWithDominators function

CallGraph generateCallGraphWithDominators(
  1. Object precompilerTrace,
  2. NodeType nodeType
)

Generates a CallGraph from the given precompilerTrace, which is produced by --trace-precompiler-to, then collapses it down to the granularity specified by nodeType, and computes dominators of the resulting graph.

Implementation

CallGraph generateCallGraphWithDominators(
  Object precompilerTrace,
  NodeType nodeType,
) {
  var callGraph = loadTrace(precompilerTrace);

  // Convert call graph into the approximate dependency graph, dropping any
  // dynamic and dispatch table based dependencies from the graph and only
  // following the static call, field access and allocation edges.
  callGraph = callGraph.collapse(nodeType, dropCallNodes: true)
    ..computeDominators();

  return callGraph;
}