phi
The PhiFunction
block
Current block where we propagate dependences
# Propagate the dependences of the phi-functions into following variables
# `phi` The PhiFunction
# `block` Current block where we propagate dependences
fun propagate_dependences(phi: PhiFunction, block: BasicBlock)
do
# Treat each block once
if block.treated then return
# For each variable access site in the block
for site in block.variables_sites do
if site isa AVarExpr then
# Propagate the dependences of the phi-function in variables after the phi
for dep in phi.dependences do
for expr in dep.first.dep_exprs do
if site.variable.dep_exprs.has(expr) then break
if dep.first.original_variable == site.variable.original_variable then
site.variable.dep_exprs.add(expr)
end
end
end
else
# The site is a variable write, we stop the propagation
return
end
end
block.treated = true
# If we do not meet a variable write, continue the propagation
for b in block.successors do propagate_dependences(phi, b)
end
src/ssa.nit:437,2--468,4