nitc :: APropdef :: ssa_destruction
ssa
Current instance of SSA
# Transform SSA-representation into an executable code (delete phi-functions)
# `ssa` Current instance of SSA
fun ssa_destruction(ssa: SSA)
do
var builder = new ASTBuilder(mpropdef.mclassdef.mmodule, mpropdef.mclassdef.bound_mtype)
# Iterate over all phi-functions
for phi in ssa.phi_functions do
for dep in phi.dependences do
# dep.second is the block where we need to create a varassign
var var_read = builder.make_var_read(dep.first, dep.first.declared_type.as(not null))
var nvar = builder.make_var_assign(dep.first, var_read)
var block = dep.second.last.parent
# This variable read must be add to a ABlockExpr
if block isa ABlockExpr then
block.add(nvar)
end
propagate_dependences(phi, phi.block)
ssa.propdef.variables.add(dep.first)
end
end
end
src/ssa.nit:411,2--435,4