| 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-selector.h" | 8 #include "src/compiler/instruction-selector.h" |
| 9 #include "src/compiler/instruction.h" | 9 #include "src/compiler/instruction.h" |
| 10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 GetVReg(node))); | 43 GetVReg(node))); |
| 44 } | 44 } |
| 45 | 45 |
| 46 InstructionOperand DefineSameAsFirst(Node* node) { | 46 InstructionOperand DefineSameAsFirst(Node* node) { |
| 47 return Define(node, | 47 return Define(node, |
| 48 UnallocatedOperand(UnallocatedOperand::SAME_AS_FIRST_INPUT, | 48 UnallocatedOperand(UnallocatedOperand::SAME_AS_FIRST_INPUT, |
| 49 GetVReg(node))); | 49 GetVReg(node))); |
| 50 } | 50 } |
| 51 | 51 |
| 52 InstructionOperand DefineAsFixed(Node* node, Register reg) { | 52 InstructionOperand DefineAsFixed(Node* node, Register reg) { |
| 53 return Define(node, UnallocatedOperand(UnallocatedOperand::FIXED_REGISTER, | 53 UnallocatedOperand op = DefineAsFixedForVreg(GetVReg(node), reg); |
| 54 reg.code(), GetVReg(node))); | 54 return Define(node, op); |
| 55 } |
| 56 |
| 57 UnallocatedOperand DefineAsFixedForVreg(int vreg, Register reg) { |
| 58 return UnallocatedOperand(UnallocatedOperand::FIXED_REGISTER, reg.code(), |
| 59 vreg); |
| 55 } | 60 } |
| 56 | 61 |
| 57 template <typename FPRegType> | 62 template <typename FPRegType> |
| 58 InstructionOperand DefineAsFixed(Node* node, FPRegType reg) { | 63 InstructionOperand DefineAsFixed(Node* node, FPRegType reg) { |
| 59 return Define(node, | 64 return Define(node, |
| 60 UnallocatedOperand(UnallocatedOperand::FIXED_FP_REGISTER, | 65 UnallocatedOperand(UnallocatedOperand::FIXED_FP_REGISTER, |
| 61 reg.code(), GetVReg(node))); | 66 reg.code(), GetVReg(node))); |
| 62 } | 67 } |
| 63 | 68 |
| 64 InstructionOperand DefineAsConstant(Node* node) { | 69 InstructionOperand DefineAsConstant(Node* node) { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 UnallocatedOperand::USED_AT_START, | 186 UnallocatedOperand::USED_AT_START, |
| 182 sequence()->NextVirtualRegister()); | 187 sequence()->NextVirtualRegister()); |
| 183 } | 188 } |
| 184 | 189 |
| 185 int AllocateVirtualRegister() { return sequence()->NextVirtualRegister(); } | 190 int AllocateVirtualRegister() { return sequence()->NextVirtualRegister(); } |
| 186 | 191 |
| 187 InstructionOperand DefineSameAsFirstForVreg(int vreg) { | 192 InstructionOperand DefineSameAsFirstForVreg(int vreg) { |
| 188 return UnallocatedOperand(UnallocatedOperand::SAME_AS_FIRST_INPUT, vreg); | 193 return UnallocatedOperand(UnallocatedOperand::SAME_AS_FIRST_INPUT, vreg); |
| 189 } | 194 } |
| 190 | 195 |
| 191 InstructionOperand DefineAsRegistertForVreg(int vreg) { | 196 InstructionOperand DefineAsRegisterForVreg(int vreg) { |
| 192 return UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg); | 197 return UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, vreg); |
| 193 } | 198 } |
| 194 | 199 |
| 200 InstructionOperand UseFixedForVreg(int vreg, Register reg) { |
| 201 return UnallocatedOperand(UnallocatedOperand::FIXED_REGISTER, reg.code(), |
| 202 vreg); |
| 203 } |
| 204 |
| 195 InstructionOperand UseRegisterForVreg(int vreg) { | 205 InstructionOperand UseRegisterForVreg(int vreg) { |
| 196 return UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, | 206 return UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, |
| 197 UnallocatedOperand::USED_AT_START, vreg); | 207 UnallocatedOperand::USED_AT_START, vreg); |
| 198 } | 208 } |
| 199 | 209 |
| 200 InstructionOperand TempDoubleRegister() { | 210 InstructionOperand TempDoubleRegister() { |
| 201 UnallocatedOperand op = UnallocatedOperand( | 211 UnallocatedOperand op = UnallocatedOperand( |
| 202 UnallocatedOperand::MUST_HAVE_REGISTER, | 212 UnallocatedOperand::MUST_HAVE_REGISTER, |
| 203 UnallocatedOperand::USED_AT_START, sequence()->NextVirtualRegister()); | 213 UnallocatedOperand::USED_AT_START, sequence()->NextVirtualRegister()); |
| 204 sequence()->MarkAsRepresentation(MachineRepresentation::kFloat64, | 214 sequence()->MarkAsRepresentation(MachineRepresentation::kFloat64, |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 BasicBlock* true_block_; // Only valid if mode_ == kFlags_branch. | 497 BasicBlock* true_block_; // Only valid if mode_ == kFlags_branch. |
| 488 BasicBlock* false_block_; // Only valid if mode_ == kFlags_branch. | 498 BasicBlock* false_block_; // Only valid if mode_ == kFlags_branch. |
| 489 Runtime::FunctionId trap_id_; // Only valid if mode_ == kFlags_trap. | 499 Runtime::FunctionId trap_id_; // Only valid if mode_ == kFlags_trap. |
| 490 }; | 500 }; |
| 491 | 501 |
| 492 } // namespace compiler | 502 } // namespace compiler |
| 493 } // namespace internal | 503 } // namespace internal |
| 494 } // namespace v8 | 504 } // namespace v8 |
| 495 | 505 |
| 496 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ | 506 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ |
| OLD | NEW |