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

Side by Side Diff: src/compiler/x64/instruction-selector-x64.cc

Issue 2239813002: [compiler] Allow matcher to work on arch without scaling capability (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Use Flags Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <algorithm> 5 #include <algorithm>
6 6
7 #include "src/base/adapters.h" 7 #include "src/base/adapters.h"
8 #include "src/compiler/instruction-selector-impl.h" 8 #include "src/compiler/instruction-selector-impl.h"
9 #include "src/compiler/node-matchers.h" 9 #include "src/compiler/node-matchers.h"
10 #include "src/compiler/node-properties.h" 10 #include "src/compiler/node-properties.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 inputs[(*input_count)++] = UseRegister(index); 121 inputs[(*input_count)++] = UseRegister(index);
122 } 122 }
123 } 123 }
124 } 124 }
125 return mode; 125 return mode;
126 } 126 }
127 127
128 AddressingMode GetEffectiveAddressMemoryOperand(Node* operand, 128 AddressingMode GetEffectiveAddressMemoryOperand(Node* operand,
129 InstructionOperand inputs[], 129 InstructionOperand inputs[],
130 size_t* input_count) { 130 size_t* input_count) {
131 BaseWithIndexAndDisplacement64Matcher m(operand, true); 131 BaseWithIndexAndDisplacement64Matcher m(
132 operand, BaseWithIndexAndDisplacement64Matcher::kAllowAll);
132 DCHECK(m.matches()); 133 DCHECK(m.matches());
133 if ((m.displacement() == nullptr || CanBeImmediate(m.displacement()))) { 134 if ((m.displacement() == nullptr || CanBeImmediate(m.displacement()))) {
134 return GenerateMemoryOperandInputs( 135 return GenerateMemoryOperandInputs(
135 m.index(), m.scale(), m.base(), m.displacement(), 136 m.index(), m.scale(), m.base(), m.displacement(),
136 m.displacement_mode(), inputs, input_count); 137 m.displacement_mode(), inputs, input_count);
137 } else { 138 } else {
138 inputs[(*input_count)++] = UseRegister(operand->InputAt(0)); 139 inputs[(*input_count)++] = UseRegister(operand->InputAt(0));
139 inputs[(*input_count)++] = UseRegister(operand->InputAt(1)); 140 inputs[(*input_count)++] = UseRegister(operand->InputAt(1));
140 return kMode_MR1; 141 return kMode_MR1;
141 } 142 }
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 } 647 }
647 648
648 649
649 void InstructionSelector::VisitWord64Sar(Node* node) { 650 void InstructionSelector::VisitWord64Sar(Node* node) {
650 X64OperandGenerator g(this); 651 X64OperandGenerator g(this);
651 Int64BinopMatcher m(node); 652 Int64BinopMatcher m(node);
652 if (CanCover(m.node(), m.left().node()) && m.left().IsLoad() && 653 if (CanCover(m.node(), m.left().node()) && m.left().IsLoad() &&
653 m.right().Is(32)) { 654 m.right().Is(32)) {
654 // Just load and sign-extend the interesting 4 bytes instead. This happens, 655 // Just load and sign-extend the interesting 4 bytes instead. This happens,
655 // for example, when we're loading and untagging SMIs. 656 // for example, when we're loading and untagging SMIs.
656 BaseWithIndexAndDisplacement64Matcher mleft(m.left().node(), true); 657 BaseWithIndexAndDisplacement64Matcher mleft(
658 m.left().node(), BaseWithIndexAndDisplacement64Matcher::kAllowAll);
657 if (mleft.matches() && (mleft.displacement() == nullptr || 659 if (mleft.matches() && (mleft.displacement() == nullptr ||
658 g.CanBeImmediate(mleft.displacement()))) { 660 g.CanBeImmediate(mleft.displacement()))) {
659 size_t input_count = 0; 661 size_t input_count = 0;
660 InstructionOperand inputs[3]; 662 InstructionOperand inputs[3];
661 AddressingMode mode = g.GetEffectiveAddressMemoryOperand( 663 AddressingMode mode = g.GetEffectiveAddressMemoryOperand(
662 m.left().node(), inputs, &input_count); 664 m.left().node(), inputs, &input_count);
663 if (mleft.displacement() == nullptr) { 665 if (mleft.displacement() == nullptr) {
664 // Make sure that the addressing mode indicates the presence of an 666 // Make sure that the addressing mode indicates the presence of an
665 // immediate displacement. It seems that we never use M1 and M2, but we 667 // immediate displacement. It seems that we never use M1 and M2, but we
666 // handle them here anyways. 668 // handle them here anyways.
(...skipping 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after
2202 // static 2204 // static
2203 MachineOperatorBuilder::AlignmentRequirements 2205 MachineOperatorBuilder::AlignmentRequirements
2204 InstructionSelector::AlignmentRequirements() { 2206 InstructionSelector::AlignmentRequirements() {
2205 return MachineOperatorBuilder::AlignmentRequirements:: 2207 return MachineOperatorBuilder::AlignmentRequirements::
2206 FullUnalignedAccessSupport(); 2208 FullUnalignedAccessSupport();
2207 } 2209 }
2208 2210
2209 } // namespace compiler 2211 } // namespace compiler
2210 } // namespace internal 2212 } // namespace internal
2211 } // namespace v8 2213 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698