kernel_memory_dump

Analiza zivotnog veka SPPURV 1 vezba 11

May 20th, 2015
331
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.87 KB | None | 0 0
  1. #include "LivenessAnalysis.h"
  2.  
  3. void livenessAnalysis(Instructions instructions)
  4. {
  5.   for (Instructions::reverse_iterator i = instructions.rbegin(); i != instructions.rend(); i++)
  6.   {
  7.      (*i)->out.clear();
  8.      for(Instructions::iterator j = (*i)->succ.begin();  j != (*i)->succ.end(); j++ )
  9.      {
  10.     for(Variables::iterator k = (*j)->in.begin(); k != (*j)->in.end(); k++)
  11.         {
  12.          (*i)->out.push_back((*k));
  13.     }
  14.      }  
  15.    
  16.      (*i)->out.sort();
  17.      (*i)->out.unique();
  18.  
  19.      (*i)->in = (*i)->use;
  20.      for(Variables::iterator j = (*i)->out.begin(); j != (*i)->out.end(); j++)
  21.      {
  22.     bool found = false;
  23.     for(Variables::iterator k = (*i)->def.begin(); k != (*i)->def.end(); k++)
  24.     {
  25.        if((*j) == (*k))
  26.        {
  27.          found = true;
  28.          break;
  29.        }
  30.     }
  31.     if(!found) (*i)->in.push_back((*j));
  32.       }
  33.    
  34.      (*i)->in.sort();
  35.      (*i)->in.unique();
  36.   }
  37. }
Add Comment
Please, Sign In to add comment