本文整理汇总了C++中LiveRange::set_in_stack方法的典型用法代码示例。如果您正苦于以下问题:C++ LiveRange::set_in_stack方法的具体用法?C++ LiveRange::set_in_stack怎么用?C++ LiveRange::set_in_stack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LiveRange
的用法示例。
在下文中一共展示了LiveRange::set_in_stack方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: splitInterval
// split [a,b] to [a, start] and [next_use, b]
void RegisterAllocator::splitInterval(int iid, int start, int reg) {
Interval* interval = all_intervals[iid];
// std::cout << "interval():" << iid << std::endl;
int next_use;
if (use_contexts.find(iid) == use_contexts.end()) next_use = INT_MAX;
else next_use = findNextUseHelper(*(use_contexts[iid]), start);
// std::cout << "findNextUseHelper():" << std::endl;
int lr_id = -1;
for (int i = 0; i < interval->liveranges.size(); i ++) {
if (interval->liveranges[i].startpoint <= start &&
start <= interval->liveranges[i].endpoint) {
lr_id = i; break;
}
}
// std::cout << "find lr_id():" << std::endl;
if (next_use == INT_MAX) {
interval->liveranges[lr_id].endpoint = start;
interval->liveranges[lr_id].pos = reg;
return ;
}
int tmp_endpoint = interval->liveranges[lr_id].endpoint; // b
interval->liveranges[lr_id].endpoint = start;
std::cout << "split_to: " << interval->liveranges[lr_id].startpoint
<< ", " << interval->liveranges[lr_id].endpoint << std::endl;
// insert an new holes
LiveRange hole (start, next_use);
stack.push_back(iid);
hole.set_in_stack (stack.size()-1);
interval->holes.push_back(hole);
std::cout << "hole: " << hole.startpoint << ", " << hole.endpoint << std::endl;
// insert an new live range
LiveRange lr (next_use, tmp_endpoint);
lr.set_in_register(reg);
// std::cout << "insert():" << std::endl;
interval->liveranges.insert(interval->liveranges.begin()+lr_id+1, lr);
insert_intervals(iid, next_use);
// system state update: transit iid from active to inactive
active.erase(iid);
inactive.insert(iid);
return ;
}