// will need to be loaded from the binding after the call!
Set<Variable> newReqdLoads = new HashSet<Variable>(reqdLoads);
it.next();
for (Variable v : reqdLoads) {
if (cl_blp.scopeDefinesVariable(v)) {
it.add(new LoadFromBindingInstr(v, s, v.getName()));
it.previous();
newReqdLoads.remove(v);
}
}
it.previous();
reqdLoads = newReqdLoads;
// add loads in the closure
((BindingLoadPlacementProblem) cl_cfg.getDataFlowSolution(blp.getName())).addLoads();
} else if (call.requiresBinding()) {
it.next();
for (Variable v : reqdLoads) {
it.add(new LoadFromBindingInstr(v, s, v.getName()));
it.previous();
}
it.previous();
reqdLoads.clear();
}
}
// The variables used as arguments will need to be loaded
for (Variable x : i.getUsedVariables()) {
if (x instanceof LocalVariable)
reqdLoads.add(x);
}
}
// Load first use of variables in closures
if ((s instanceof IRClosure) && (_bb == _prob.getCFG().getEntryBB())) {
/**
System.out.println("\n[In Entry BB] For CFG " + _prob.getCFG() + ":");
System.out.println("\t--> Reqd loads : " + java.util.Arrays.toString(reqdLoads.toArray()));
**/
for (Variable v : reqdLoads) {
if (blp.scopeUsesVariable(v)) {
it.add(new LoadFromBindingInstr(v, s, v.getName()));
}
}
}
}