R/process_cfg_phis.R

Defines functions findPhiAssignVarNames getPhiAssign

# NOTE: It looks like Duncan's intent here was to find which definitions
# propagate to each phi-function.

findPhiAssignVarNames =
function(cfg, ssa.graph = cfg$ssa$graph)
{
  phis = lapply(cfg$blocks, function(x) x$phi)
  w = sapply(phis, length) > 0

    # Find the p
  lapply(phis[w], function(x) lapply(x, function(x) getPhiAssign(x$write$name, cfg, ssa.graph)))
  
}

  

# If we had a reference to the Symbol in the read, we could mark that directly.


getPhiAssign =
function(sym, cfg, ssa.graph = cfg$ssa$graph)
{
  defs = igraph::neighbors(ssa.graph, sym, "in")
  as_ids(defs)
}
nick-ulle/ast documentation built on Oct. 18, 2019, 4:37 a.m.