Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void livenessAnalysis(Instructions instructions)
- {
- for(Instructions::reverse_iterator i=instructions.rbegin();i!=instructions.rend();i++)
- {
- (*i)->out.clear();
- for(Instructions::iterator j=(*i)->succ.begin();j!=(*i)->succ.end();j++)
- {
- for(Variables::iterator k=(*j)->in.begin();k!=(*j)->in.end();k++)
- {
- (*i)->out.push_back((*k));
- }
- }
- (*i)->out.sort();
- (*i)->out.unique();
- (*i)->in=(*i)->use;
- for(Variables::iterator j=(*i)->out.begin();j!=(*i)->out.end();j++)
- {
- bool found=false;
- for(Variables::iterator k=(*i)->def.begin();k!=(*i)->def.end();k++)
- {
- if((*j)==(*k))
- {
- found=true;
- break;
- }
- }
- if(!found)(*i)->in.push_back((*j));
- }
- (*i)->in.sort();
- (*i)->in.unique();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement