void ReturnByRef::apply() { RefMap map; RefMap::iterator iter; returnByRefCollectCalls(map); for (iter = map.begin(); iter != map.end(); iter++) iter->second->transform(); for (int i = 0; i < virtualMethodTable.n; i++) { if (virtualMethodTable.v[i].key) { int numFns = virtualMethodTable.v[i].value->n; for (int j = 0; j < numFns; j++) { FnSymbol* fn = virtualMethodTable.v[i].value->v[j]; if (isTransformableFunction(fn)) transformFunction(fn); } } } }
void ReturnByRef::apply() { RefMap map; RefMap::iterator iter; FnSet asgnUpdates; returnByRefCollectCalls(map, asgnUpdates); for (iter = map.begin(); iter != map.end(); iter++) iter->second->transform(); for_set(FnSymbol, fn, asgnUpdates) updateAssignments(fn); for (int i = 0; i < virtualMethodTable.n; i++) { if (virtualMethodTable.v[i].key) { int numFns = virtualMethodTable.v[i].value->n; for (int j = 0; j < numFns; j++) { FnSymbol* fn = virtualMethodTable.v[i].value->v[j]; TransformationKind tfKind = transformableFunctionKind(fn); if (tfKind == TF_FULL) transformFunction(fn); else if (tfKind == TF_ASGN) updateAssignments(fn); } } } }
void Liveness::emptify(RefMap &M) { for (auto I = M.begin(), E = M.end(); I != E; ) I = I->second.empty() ? M.erase(I) : std::next(I); }