Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void populate_map(MapOrInfo ¤t_map, std::vector<FullProcInfo> &proc_infos)
- {
- std::vector<FullProcInfo> this_tier;
- std::vector<FullProcInfo> next_tier;
- uint32 ThisSigMask = uint32(-1);
- for (auto iter = proc_infos.begin(); iter != proc_infos.end(); ++iter)
- {
- const FullProcInfo &procInfo = *iter;
- ThisSigMask &= procInfo.InstructionMask;
- }
- assert(ThisSigMask != 0);
- current_map.Mask = ThisSigMask;
- while (proc_infos.size())
- {
- uint32 NewMask;
- bool SetNewMask = false;
- for (auto iter = proc_infos.begin(); iter != proc_infos.end();)
- {
- const FullProcInfo &procInfo = *iter;
- if (!SetNewMask || NewMask == (procInfo.RefMask & ThisSigMask))
- {
- NewMask = (procInfo.RefMask & ThisSigMask);
- SetNewMask = true;
- next_tier.push_back(procInfo);
- iter = proc_infos.erase(iter);
- }
- else
- {
- ++iter;
- }
- }
- if (next_tier.size())
- {
- auto &next_map = current_map.Map[NewMask];
- if (next_tier.size() == 1)
- {
- next_map.Info = next_tier.front().ProcInfo;
- }
- else
- {
- next_map.init_map();
- populate_map(next_map, next_tier);
- }
- next_tier.clear();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement