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 #ifndef V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ | 5 #ifndef V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ |
6 #define V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ | 6 #define V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ |
7 | 7 |
8 #include "src/compiler/instruction.h" | 8 #include "src/compiler/instruction.h" |
9 #include "src/compiler/instruction-selector.h" | 9 #include "src/compiler/instruction-selector.h" |
10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
121 return Use(node, UnallocatedOperand(UnallocatedOperand::FIXED_REGISTER, | 121 return Use(node, UnallocatedOperand(UnallocatedOperand::FIXED_REGISTER, |
122 reg.code(), GetVReg(node))); | 122 reg.code(), GetVReg(node))); |
123 } | 123 } |
124 | 124 |
125 InstructionOperand UseFixed(Node* node, DoubleRegister reg) { | 125 InstructionOperand UseFixed(Node* node, DoubleRegister reg) { |
126 return Use(node, | 126 return Use(node, |
127 UnallocatedOperand(UnallocatedOperand::FIXED_DOUBLE_REGISTER, | 127 UnallocatedOperand(UnallocatedOperand::FIXED_DOUBLE_REGISTER, |
128 reg.code(), GetVReg(node))); | 128 reg.code(), GetVReg(node))); |
129 } | 129 } |
130 | 130 |
131 InstructionOperand UseExplicit(Register reg) { | 131 InstructionOperand UseExplicit(LinkageLocation location) { |
132 MachineType machine_type = InstructionSequence::DefaultRepresentation(); | 132 MachineType machine_type = InstructionSequence::DefaultRepresentation(); |
133 return ExplicitOperand(LocationOperand::REGISTER, machine_type, reg.code()); | 133 if (location.IsRegister()) { |
134 return ExplicitOperand(LocationOperand::REGISTER, machine_type, | |
135 location.AsRegister()); | |
136 } else { | |
137 return ExplicitOperand(LocationOperand::STACK_SLOT, machine_type, | |
138 location.GetLocation()); | |
139 } | |
134 } | 140 } |
135 | 141 |
136 InstructionOperand UseImmediate(Node* node) { | 142 InstructionOperand UseImmediate(Node* node) { |
137 return sequence()->AddImmediate(ToConstant(node)); | 143 return sequence()->AddImmediate(ToConstant(node)); |
138 } | 144 } |
139 | 145 |
140 InstructionOperand UseLocation(Node* node, LinkageLocation location, | 146 InstructionOperand UseLocation(Node* node, LinkageLocation location, |
141 MachineType type) { | 147 MachineType type) { |
142 return Use(node, ToUnallocatedOperand(location, type, GetVReg(node))); | 148 return Use(node, ToUnallocatedOperand(location, type, GetVReg(node))); |
143 } | 149 } |
144 | 150 |
151 // Used to force gap moves from the from_location to the to_location | |
152 // immediately before an instruction. | |
153 InstructionOperand UseLocation(LinkageLocation to_location, | |
154 LinkageLocation from_location, | |
155 MachineType type) { | |
156 UnallocatedOperand casted_from_operand = | |
157 UnallocatedOperand::cast(TempLocation( | |
158 from_location, static_cast<MachineType>(kTypeAny | kMachPtr))); | |
Jarin
2015/11/20 10:56:09
Why does not this use the incoming type? As sugges
danno
2015/11/20 14:43:23
Done.
| |
159 selector_->Emit(kArchNop, casted_from_operand); | |
160 return ToUnallocatedOperand(to_location, type, | |
161 casted_from_operand.virtual_register()); | |
162 } | |
163 | |
145 InstructionOperand TempRegister() { | 164 InstructionOperand TempRegister() { |
146 return UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, | 165 return UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, |
147 UnallocatedOperand::USED_AT_START, | 166 UnallocatedOperand::USED_AT_START, |
148 sequence()->NextVirtualRegister()); | 167 sequence()->NextVirtualRegister()); |
149 } | 168 } |
150 | 169 |
151 InstructionOperand TempDoubleRegister() { | 170 InstructionOperand TempDoubleRegister() { |
152 UnallocatedOperand op = UnallocatedOperand( | 171 UnallocatedOperand op = UnallocatedOperand( |
153 UnallocatedOperand::MUST_HAVE_REGISTER, | 172 UnallocatedOperand::MUST_HAVE_REGISTER, |
154 UnallocatedOperand::USED_AT_START, sequence()->NextVirtualRegister()); | 173 UnallocatedOperand::USED_AT_START, sequence()->NextVirtualRegister()); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
341 Node* result_; // Only valid if mode_ == kFlags_set. | 360 Node* result_; // Only valid if mode_ == kFlags_set. |
342 BasicBlock* true_block_; // Only valid if mode_ == kFlags_branch. | 361 BasicBlock* true_block_; // Only valid if mode_ == kFlags_branch. |
343 BasicBlock* false_block_; // Only valid if mode_ == kFlags_branch. | 362 BasicBlock* false_block_; // Only valid if mode_ == kFlags_branch. |
344 }; | 363 }; |
345 | 364 |
346 } // namespace compiler | 365 } // namespace compiler |
347 } // namespace internal | 366 } // namespace internal |
348 } // namespace v8 | 367 } // namespace v8 |
349 | 368 |
350 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ | 369 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ |
OLD | NEW |