示例#1
0
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);
      }
    }
  }
}
示例#2
0
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);
      }
    }
  }
}
示例#3
0
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);
}