Commit 4fa721c6 authored by Zhao Jiazhong's avatar Zhao Jiazhong Committed by Commit Bot

[mips32][turbofan] Don't assume that some Word32AtomicPair nodes has a projection-0

Port e56a7edb https://crrev.com/c/2002547
Port e15f5ba1 https://crrev.com/c/2011829
Port bc436ed7 https://crrev.com/c/2030731

Original Commit Message:

  The instruction selector assumed for Word32AtomicPair{Load, Binops,
  CompareExchange} nodes that if there exists a Projection(1) user, then
  there also exists a Projection(0) user. This, however, is not the case,
  because TurboFan eliminates unreachable nodes. The missing projection
  node lead to a failed DCHECK in the register allocator.

Change-Id: I498f751c0c0a4a609f0016d17269eab8f6727229
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2056886Reviewed-by: 's avatarDeepti Gandluri <gdeepti@chromium.org>
Commit-Queue: Deepti Gandluri <gdeepti@chromium.org>
Auto-Submit: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Cr-Commit-Position: refs/heads/master@{#66361}
parent 3241aa10
......@@ -233,33 +233,31 @@ static void VisitPairAtomicBinop(InstructionSelector* selector, Node* node,
Node* index = node->InputAt(1);
Node* value = node->InputAt(2);
Node* value_high = node->InputAt(3);
AddressingMode addressing_mode = kMode_None;
InstructionCode code = opcode | AddressingModeField::encode(addressing_mode);
InstructionOperand inputs[] = {g.UseRegister(base), g.UseRegister(index),
g.UseFixed(value, a1),
g.UseFixed(value_high, a2)};
InstructionOperand outputs[2];
size_t output_count = 0;
InstructionOperand temps[3];
size_t temp_count = 0;
temps[temp_count++] = g.TempRegister(a0);
Node* projection0 = NodeProperties::FindProjection(node, 0);
Node* projection1 = NodeProperties::FindProjection(node, 1);
if (projection0) {
outputs[output_count++] = g.DefineAsFixed(projection0, v0);
} else {
temps[temp_count++] = g.TempRegister(v0);
}
if (projection1) {
InstructionOperand outputs[] = {g.DefineAsFixed(projection0, v0),
g.DefineAsFixed(projection1, v1)};
InstructionOperand temps[] = {g.TempRegister(a0), g.TempRegister(),
g.TempRegister()};
selector->Emit(opcode | AddressingModeField::encode(kMode_None),
arraysize(outputs), outputs, arraysize(inputs), inputs,
arraysize(temps), temps);
} else if (projection0) {
InstructionOperand outputs[] = {g.DefineAsFixed(projection0, v0)};
InstructionOperand temps[] = {g.TempRegister(a0), g.TempRegister(v1),
g.TempRegister()};
selector->Emit(opcode | AddressingModeField::encode(kMode_None),
arraysize(outputs), outputs, arraysize(inputs), inputs,
arraysize(temps), temps);
outputs[output_count++] = g.DefineAsFixed(projection1, v1);
} else {
InstructionOperand temps[] = {g.TempRegister(a0), g.TempRegister(v0),
g.TempRegister(v1)};
selector->Emit(opcode | AddressingModeField::encode(kMode_None), 0, nullptr,
arraysize(inputs), inputs, arraysize(temps), temps);
temps[temp_count++] = g.TempRegister(v1);
}
selector->Emit(code, output_count, outputs, arraysize(inputs), inputs,
temp_count, temps);
}
void InstructionSelector::VisitStackSlot(Node* node) {
......@@ -729,29 +727,29 @@ void InstructionSelector::VisitWord32AtomicPairLoad(Node* node) {
Node* base = node->InputAt(0);
Node* index = node->InputAt(1);
ArchOpcode opcode = kMipsWord32AtomicPairLoad;
AddressingMode addressing_mode = kMode_MRI;
InstructionCode code = opcode | AddressingModeField::encode(addressing_mode);
InstructionOperand inputs[] = {g.UseRegister(base), g.UseRegister(index)};
InstructionOperand temps[3];
size_t temp_count = 0;
temps[temp_count++] = g.TempRegister(a0);
InstructionOperand outputs[2];
size_t output_count = 0;
Node* projection0 = NodeProperties::FindProjection(node, 0);
Node* projection1 = NodeProperties::FindProjection(node, 1);
InstructionOperand inputs[] = {g.UseRegister(base), g.UseRegister(index)};
if (projection0) {
outputs[output_count++] = g.DefineAsFixed(projection0, v0);
} else {
temps[temp_count++] = g.TempRegister(v0);
}
if (projection1) {
InstructionOperand outputs[] = {g.DefineAsFixed(projection0, v0),
g.DefineAsFixed(projection1, v1)};
InstructionOperand temps[] = {g.TempRegister(a0)};
Emit(opcode | AddressingModeField::encode(kMode_MRI), arraysize(outputs),
outputs, arraysize(inputs), inputs, arraysize(temps), temps);
} else if (projection0) {
InstructionOperand outputs[] = {g.DefineAsFixed(projection0, v0)};
InstructionOperand temps[] = {g.TempRegister(a0), g.TempRegister(v1)};
Emit(opcode | AddressingModeField::encode(kMode_MRI), arraysize(outputs),
outputs, arraysize(inputs), inputs, arraysize(temps), temps);
outputs[output_count++] = g.DefineAsFixed(projection1, v1);
} else {
InstructionOperand temps[] = {g.TempRegister(a0), g.TempRegister(v0),
g.TempRegister(v1)};
Emit(opcode | AddressingModeField::encode(kMode_MRI), 0, nullptr,
arraysize(inputs), inputs, arraysize(temps), temps);
temps[temp_count++] = g.TempRegister(v1);
}
Emit(code, output_count, outputs, arraysize(inputs), inputs, temp_count,
temps);
}
void InstructionSelector::VisitWord32AtomicPairStore(Node* node) {
......@@ -805,22 +803,23 @@ void InstructionSelector::VisitWord32AtomicPairCompareExchange(Node* node) {
AddressingModeField::encode(kMode_MRI);
Node* projection0 = NodeProperties::FindProjection(node, 0);
Node* projection1 = NodeProperties::FindProjection(node, 1);
InstructionOperand outputs[2];
size_t output_count = 0;
InstructionOperand temps[3];
size_t temp_count = 0;
temps[temp_count++] = g.TempRegister(a0);
if (projection0) {
outputs[output_count++] = g.DefineAsFixed(projection0, v0);
} else {
temps[temp_count++] = g.TempRegister(v0);
}
if (projection1) {
InstructionOperand outputs[] = {g.DefineAsFixed(projection0, v0),
g.DefineAsFixed(projection1, v1)};
InstructionOperand temps[] = {g.TempRegister(a0)};
Emit(code, arraysize(outputs), outputs, arraysize(inputs), inputs,
arraysize(temps), temps);
} else if (projection0) {
InstructionOperand outputs[] = {g.DefineAsFixed(projection0, v0)};
InstructionOperand temps[] = {g.TempRegister(a0), g.TempRegister(v1)};
Emit(code, arraysize(outputs), outputs, arraysize(inputs), inputs,
arraysize(temps), temps);
outputs[output_count++] = g.DefineAsFixed(projection1, v1);
} else {
InstructionOperand temps[] = {g.TempRegister(a0), g.TempRegister(v0),
g.TempRegister(v1)};
Emit(code, 0, nullptr, arraysize(inputs), inputs, arraysize(temps), temps);
temps[temp_count++] = g.TempRegister(v1);
}
Emit(code, output_count, outputs, arraysize(inputs), inputs, temp_count,
temps);
}
void InstructionSelector::VisitWord32ReverseBits(Node* node) { UNREACHABLE(); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment