Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Unified Diff: src/compiler/mips/instruction-selector-mips.cc

Issue 2428443002: [wasm] Trim graph before scheduling. (Closed)
Patch Set: Use proper temp registers if Projection(1) does not exist. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/mips/code-generator-mips.cc ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/mips/instruction-selector-mips.cc
diff --git a/src/compiler/mips/instruction-selector-mips.cc b/src/compiler/mips/instruction-selector-mips.cc
index 0a98930b5c4ce8ee779e045ba804e17156c0b58a..b3e69eb5a13e6caab2a80a22067aaaab9a1bafa1 100644
--- a/src/compiler/mips/instruction-selector-mips.cc
+++ b/src/compiler/mips/instruction-selector-mips.cc
@@ -429,32 +429,43 @@ void InstructionSelector::VisitWord32Sar(Node* node) {
}
static void VisitInt32PairBinop(InstructionSelector* selector,
- InstructionCode opcode, Node* node) {
+ InstructionCode pair_opcode,
+ InstructionCode single_opcode, Node* node) {
MipsOperandGenerator g(selector);
- // We use UseUniqueRegister here to avoid register sharing with the output
- // register.
- InstructionOperand inputs[] = {g.UseUniqueRegister(node->InputAt(0)),
- g.UseUniqueRegister(node->InputAt(1)),
- g.UseUniqueRegister(node->InputAt(2)),
- g.UseUniqueRegister(node->InputAt(3))};
+ Node* projection1 = NodeProperties::FindProjection(node, 1);
+
+ if (projection1) {
+ // We use UseUniqueRegister here to avoid register sharing with the output
+ // register.
+ InstructionOperand inputs[] = {g.UseUniqueRegister(node->InputAt(0)),
+ g.UseUniqueRegister(node->InputAt(1)),
+ g.UseUniqueRegister(node->InputAt(2)),
+ g.UseUniqueRegister(node->InputAt(3))};
- InstructionOperand outputs[] = {
- g.DefineAsRegister(node),
- g.DefineAsRegister(NodeProperties::FindProjection(node, 1))};
- selector->Emit(opcode, 2, outputs, 4, inputs);
+ InstructionOperand outputs[] = {
+ g.DefineAsRegister(node),
+ g.DefineAsRegister(NodeProperties::FindProjection(node, 1))};
+ selector->Emit(pair_opcode, 2, outputs, 4, inputs);
+ } else {
+ // The high word of the result is not used, so we emit the standard 32 bit
+ // instruction.
+ selector->Emit(single_opcode, g.DefineSameAsFirst(node),
+ g.UseRegister(node->InputAt(0)),
+ g.UseRegister(node->InputAt(2)));
+ }
}
void InstructionSelector::VisitInt32PairAdd(Node* node) {
- VisitInt32PairBinop(this, kMipsAddPair, node);
+ VisitInt32PairBinop(this, kMipsAddPair, kMipsAdd, node);
}
void InstructionSelector::VisitInt32PairSub(Node* node) {
- VisitInt32PairBinop(this, kMipsSubPair, node);
+ VisitInt32PairBinop(this, kMipsSubPair, kMipsSub, node);
}
void InstructionSelector::VisitInt32PairMul(Node* node) {
- VisitInt32PairBinop(this, kMipsMulPair, node);
+ VisitInt32PairBinop(this, kMipsMulPair, kMipsMul, node);
}
// Shared routine for multiple shift operations.
@@ -475,11 +486,21 @@ static void VisitWord32PairShift(InstructionSelector* selector,
g.UseUniqueRegister(node->InputAt(1)),
shift_operand};
- InstructionOperand outputs[] = {
- g.DefineAsRegister(node),
- g.DefineAsRegister(NodeProperties::FindProjection(node, 1))};
+ Node* projection1 = NodeProperties::FindProjection(node, 1);
+
+ InstructionOperand outputs[2];
+ InstructionOperand temps[1];
+ int32_t output_count = 0;
+ int32_t temp_count = 0;
+
+ outputs[output_count++] = g.DefineAsRegister(node);
+ if (projection1) {
+ outputs[output_count++] = g.DefineAsRegister(projection1);
+ } else {
+ temps[temp_count++] = g.TempRegister();
+ }
- selector->Emit(opcode, 2, outputs, 3, inputs);
+ selector->Emit(opcode, output_count, outputs, 3, inputs, temp_count, temps);
}
void InstructionSelector::VisitWord32PairShl(Node* node) {
« no previous file with comments | « src/compiler/mips/code-generator-mips.cc ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698