summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuiling Song <ruiling.song@intel.com>2013-08-09 13:23:41 +0800
committerZhigang Gong <zhigang.gong@linux.intel.com>2013-08-12 12:41:14 +0800
commitc17c749820ba448527e2aecff7d73973a0315a7e (patch)
tree1f1679aeb0c25255ba3cbecf5b45f58c4aff521f
parentb1b1392ef6a6d16f730e811ba5750cac0bd6631c (diff)
Skip spill/unspill instruction when trying to do spill.
We can only spill virtual registers, should skip physical register. This fix random failure of compiler_box_blur when do spilling. Signed-off-by: Ruiling Song <ruiling.song@intel.com> Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
-rw-r--r--backend/src/backend/gen_insn_selection.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/backend/src/backend/gen_insn_selection.cpp b/backend/src/backend/gen_insn_selection.cpp
index d40fbfe4..72f66295 100644
--- a/backend/src/backend/gen_insn_selection.cpp
+++ b/backend/src/backend/gen_insn_selection.cpp
@@ -629,12 +629,15 @@ namespace gbe
for (auto &block : blockList)
for (auto &insn : block.insnList) {
+ // spill / unspill insn should be skipped when do spilling
+ if(insn.opcode == SEL_OP_SPILL_REG || insn.opcode == SEL_OP_UNSPILL_REG) continue;
+
const uint32_t srcNum = insn.srcNum, dstNum = insn.dstNum;
for (uint32_t srcID = 0; srcID < srcNum; ++srcID) {
const GenRegister selReg = insn.src(srcID);
const ir::Register reg = selReg.reg();
- if(selReg.file == GEN_GENERAL_REGISTER_FILE && reg == spilledReg) {
+ if(reg == spilledReg && selReg.file == GEN_GENERAL_REGISTER_FILE && selReg.physical == 0) {
GBE_ASSERT(srcID < 5);
SelectionInstruction *unspill = this->create(SEL_OP_UNSPILL_REG, 1, 0);
unspill->state = GenInstructionState(simdWidth);
@@ -653,7 +656,7 @@ namespace gbe
for (uint32_t dstID = 0; dstID < dstNum; ++dstID) {
const GenRegister selReg = insn.dst(dstID);
const ir::Register reg = selReg.reg();
- if(selReg.file == GEN_GENERAL_REGISTER_FILE && reg == spilledReg) {
+ if(reg == spilledReg && selReg.file == GEN_GENERAL_REGISTER_FILE && selReg.physical == 0) {
GBE_ASSERT(dstID < 5);
SelectionInstruction *spill = this->create(SEL_OP_SPILL_REG, 0, 1);
spill->state = GenInstructionState(simdWidth);