nitc :: APropdef :: rename_variables
NOTE: compute_phi
must has been called before
# Compute the second phase of SSA algorithm: renaming variables
# NOTE: `compute_phi` must has been called before
fun rename_variables(ssa: SSA)
do
# A counter for each variable
# The key is the variable, the value the number of assignment into the variable
var counter = new HashMap[Variable, Int]
for v in variables do
counter[v] = 0
v.stack.push(v)
end
for phi in ssa.phi_functions do counter[phi] = 0
# Launch the recursive renaming from the root block
rename(basic_block.as(not null), counter, ssa)
end
src/ssa.nit:292,2--309,4