spill oldest reg
This appears to generate at least as fast code as spilling the register that dies latest, and has two additional advantages: - it's _very_ predictable even when reading assembly - it's a little quicker to score, not requiring another table lookup I'm still open to smart spill logic, but if we're going to have a simple baseline for comparison, I suggest we might use this one. Change-Id: Ic4775dbf0095b60cfa4b91e33ede352813d34934 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/285097 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Klein <mtklein@google.com>
This commit is contained in:
parent
fd77673c6d
commit
71d6466d1e
@ -2891,12 +2891,15 @@ namespace skvm {
|
||||
// nor any registers we need for this instruction.
|
||||
if (v == RES ||
|
||||
v == TMP || v == id || v == x || v == y || v == z) {
|
||||
return -1;
|
||||
return 0x7fff'ffff;
|
||||
}
|
||||
// Break ties somewhat arbitrarily now, by spilling the latest value to die.
|
||||
return instructions[v].death;
|
||||
// At this point spilling is arbitrary, so we're in the realm of heuristics.
|
||||
// Here, spill the oldest value. This is nice because,
|
||||
// A) it's very predictable, even in assembly, and
|
||||
// B) it's as cheap as you can get.
|
||||
return v;
|
||||
};
|
||||
avail = std::max_element(regs.begin(), regs.end(), [&](Val a, Val b) {
|
||||
avail = std::min_element(regs.begin(), regs.end(), [&](Val a, Val b) {
|
||||
return score_spills(a) < score_spills(b);
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user