OLD | NEW |
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 "src/assembler-inl.h" | 5 #include "src/assembler-inl.h" |
6 #include "src/compiler/instruction-selector-impl.h" | 6 #include "src/compiler/instruction-selector-impl.h" |
7 #include "src/compiler/node-matchers.h" | 7 #include "src/compiler/node-matchers.h" |
8 #include "src/compiler/node-properties.h" | 8 #include "src/compiler/node-properties.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // TODO(dcarney): some unencodable values can be handled by | 96 // TODO(dcarney): some unencodable values can be handled by |
97 // switching instructions. | 97 // switching instructions. |
98 return Assembler::IsImmLogical(static_cast<uint64_t>(value), 32, | 98 return Assembler::IsImmLogical(static_cast<uint64_t>(value), 32, |
99 &ignored, &ignored, &ignored); | 99 &ignored, &ignored, &ignored); |
100 case kLogical64Imm: | 100 case kLogical64Imm: |
101 return Assembler::IsImmLogical(static_cast<uint64_t>(value), 64, | 101 return Assembler::IsImmLogical(static_cast<uint64_t>(value), 64, |
102 &ignored, &ignored, &ignored); | 102 &ignored, &ignored, &ignored); |
103 case kArithmeticImm: | 103 case kArithmeticImm: |
104 return Assembler::IsImmAddSub(value); | 104 return Assembler::IsImmAddSub(value); |
105 case kLoadStoreImm8: | 105 case kLoadStoreImm8: |
106 return IsLoadStoreImmediate(value, LSByte); | 106 return IsLoadStoreImmediate(value, 0); |
107 case kLoadStoreImm16: | 107 case kLoadStoreImm16: |
108 return IsLoadStoreImmediate(value, LSHalfword); | 108 return IsLoadStoreImmediate(value, 1); |
109 case kLoadStoreImm32: | 109 case kLoadStoreImm32: |
110 return IsLoadStoreImmediate(value, LSWord); | 110 return IsLoadStoreImmediate(value, 2); |
111 case kLoadStoreImm64: | 111 case kLoadStoreImm64: |
112 return IsLoadStoreImmediate(value, LSDoubleWord); | 112 return IsLoadStoreImmediate(value, 3); |
113 case kNoImmediate: | 113 case kNoImmediate: |
114 return false; | 114 return false; |
115 case kShift32Imm: // Fall through. | 115 case kShift32Imm: // Fall through. |
116 case kShift64Imm: | 116 case kShift64Imm: |
117 // Shift operations only observe the bottom 5 or 6 bits of the value. | 117 // Shift operations only observe the bottom 5 or 6 bits of the value. |
118 // All possible shifts can be encoded by discarding bits which have no | 118 // All possible shifts can be encoded by discarding bits which have no |
119 // effect. | 119 // effect. |
120 return true; | 120 return true; |
121 } | 121 } |
122 return false; | 122 return false; |
123 } | 123 } |
124 | 124 |
125 bool CanBeLoadStoreShiftImmediate(Node* node, MachineRepresentation rep) { | 125 bool CanBeLoadStoreShiftImmediate(Node* node, MachineRepresentation rep) { |
126 // TODO(arm64): Load and Store on 128 bit Q registers is not supported yet. | 126 // TODO(arm64): Load and Store on 128 bit Q registers is not supported yet. |
127 DCHECK_GT(MachineRepresentation::kSimd128, rep); | 127 DCHECK_GT(MachineRepresentation::kSimd128, rep); |
128 return IsIntegerConstant(node) && | 128 return IsIntegerConstant(node) && |
129 (GetIntegerConstantValue(node) == ElementSizeLog2Of(rep)); | 129 (GetIntegerConstantValue(node) == ElementSizeLog2Of(rep)); |
130 } | 130 } |
131 | 131 |
132 private: | 132 private: |
133 bool IsLoadStoreImmediate(int64_t value, LSDataSize size) { | 133 bool IsLoadStoreImmediate(int64_t value, unsigned size) { |
134 return Assembler::IsImmLSScaled(value, size) || | 134 return Assembler::IsImmLSScaled(value, size) || |
135 Assembler::IsImmLSUnscaled(value); | 135 Assembler::IsImmLSUnscaled(value); |
136 } | 136 } |
137 }; | 137 }; |
138 | 138 |
139 | 139 |
140 namespace { | 140 namespace { |
141 | 141 |
142 void VisitRR(InstructionSelector* selector, ArchOpcode opcode, Node* node) { | 142 void VisitRR(InstructionSelector* selector, ArchOpcode opcode, Node* node) { |
143 Arm64OperandGenerator g(selector); | 143 Arm64OperandGenerator g(selector); |
(...skipping 2727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2871 // static | 2871 // static |
2872 MachineOperatorBuilder::AlignmentRequirements | 2872 MachineOperatorBuilder::AlignmentRequirements |
2873 InstructionSelector::AlignmentRequirements() { | 2873 InstructionSelector::AlignmentRequirements() { |
2874 return MachineOperatorBuilder::AlignmentRequirements:: | 2874 return MachineOperatorBuilder::AlignmentRequirements:: |
2875 FullUnalignedAccessSupport(); | 2875 FullUnalignedAccessSupport(); |
2876 } | 2876 } |
2877 | 2877 |
2878 } // namespace compiler | 2878 } // namespace compiler |
2879 } // namespace internal | 2879 } // namespace internal |
2880 } // namespace v8 | 2880 } // namespace v8 |
OLD | NEW |