本文整理汇总了C++中Var::GetVarToSpill方法的典型用法代码示例。如果您正苦于以下问题:C++ Var::GetVarToSpill方法的具体用法?C++ Var::GetVarToSpill怎么用?C++ Var::GetVarToSpill使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Var
的用法示例。
在下文中一共展示了Var::GetVarToSpill方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SpillCode
bool Forest::SpillCode()
{
int c, m, n;
Var *v;
Tree *t;
BasicBlock *bb;
int64_t spillOffset;
OCODE *cd;
CSet spilled;
bool ret;
ret = false;
cd = currentFn->spAdjust;
if (cd == nullptr)
return (ret);
spillOffset = cd->oper3->offset->i;
spilled.clear();
for (c = 0; c < treecount; c++) {
t = trees[c]; // convenience
// Tree couldn't be colored that means there are no available registers.
// So, spill one of the registers. The register to spill should be one
// that isn't live at the same time as this tree.
if (t->spill) {
ret = true;
v = Var::Find(t->var);
v = v->GetVarToSpill(&spilled);
if (v == nullptr)
continue;
// The var is spilled at the head of the tree, and restored later
t->blocks->resetPtr();
m = t->blocks->nextMember();
if (m >= 0) { // should always be true, otherwise no code
bb = basicBlocks[m];
if (!spilled.isMember(v->num)) {
v->spillOffset = spillOffset;
spillOffset += sizeOfWord;
spilled.add(v->num);
}
bb->InsertSpillCode(v->num, -v->spillOffset);
while(1) {
n = m;
m = t->blocks->nextMember();
if (m < 0)
break;
// Detect when a different branch is present. The node
// number will jump by more than 1 between branches.
// *** suspect this won't work, should just pick last block in tree
if (m - n > 1) {
bb = basicBlocks[n];
bb->InsertFillCode(v->num, -v->spillOffset);
}
}
bb = basicBlocks[n];
bb->InsertFillCode(v->num, -v->spillOffset);
}
t->spill = false;
}
}
cd->oper3->offset->i = spillOffset;
return (ret);
}