| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 return Define(node, UnallocatedOperand(UnallocatedOperand::FIXED_REGISTER, |
| 54 reg.code(), GetVReg(node))); | 54 reg.code(), GetVReg(node))); |
| 55 } | 55 } |
| 56 | 56 |
| 57 InstructionOperand DefineAsFixed(Node* node, DoubleRegister reg) { | 57 template <typename FPRegType> |
| 58 InstructionOperand DefineAsFixed(Node* node, FPRegType reg) { |
| 58 return Define(node, | 59 return Define(node, |
| 59 UnallocatedOperand(UnallocatedOperand::FIXED_DOUBLE_REGISTER, | 60 UnallocatedOperand(UnallocatedOperand::FIXED_FP_REGISTER, |
| 60 reg.code(), GetVReg(node))); | 61 reg.code(), GetVReg(node))); |
| 61 } | 62 } |
| 62 | 63 |
| 63 InstructionOperand DefineAsConstant(Node* node) { | 64 InstructionOperand DefineAsConstant(Node* node) { |
| 64 selector()->MarkAsDefined(node); | 65 selector()->MarkAsDefined(node); |
| 65 int virtual_register = GetVReg(node); | 66 int virtual_register = GetVReg(node); |
| 66 sequence()->AddConstant(virtual_register, ToConstant(node)); | 67 sequence()->AddConstant(virtual_register, ToConstant(node)); |
| 67 return ConstantOperand(virtual_register); | 68 return ConstantOperand(virtual_register); |
| 68 } | 69 } |
| 69 | 70 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 InstructionOperand UseUniqueRegister(Node* node) { | 116 InstructionOperand UseUniqueRegister(Node* node) { |
| 116 return Use(node, UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, | 117 return Use(node, UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, |
| 117 GetVReg(node))); | 118 GetVReg(node))); |
| 118 } | 119 } |
| 119 | 120 |
| 120 InstructionOperand UseFixed(Node* node, Register reg) { | 121 InstructionOperand UseFixed(Node* node, Register reg) { |
| 121 return Use(node, UnallocatedOperand(UnallocatedOperand::FIXED_REGISTER, | 122 return Use(node, UnallocatedOperand(UnallocatedOperand::FIXED_REGISTER, |
| 122 reg.code(), GetVReg(node))); | 123 reg.code(), GetVReg(node))); |
| 123 } | 124 } |
| 124 | 125 |
| 125 InstructionOperand UseFixed(Node* node, DoubleRegister reg) { | 126 template <typename FPRegType> |
| 126 return Use(node, | 127 InstructionOperand UseFixed(Node* node, FPRegType reg) { |
| 127 UnallocatedOperand(UnallocatedOperand::FIXED_DOUBLE_REGISTER, | 128 return Use(node, UnallocatedOperand(UnallocatedOperand::FIXED_FP_REGISTER, |
| 128 reg.code(), GetVReg(node))); | 129 reg.code(), GetVReg(node))); |
| 129 } | 130 } |
| 130 | 131 |
| 131 InstructionOperand UseExplicit(LinkageLocation location) { | 132 InstructionOperand UseExplicit(LinkageLocation location) { |
| 132 MachineRepresentation rep = InstructionSequence::DefaultRepresentation(); | 133 MachineRepresentation rep = InstructionSequence::DefaultRepresentation(); |
| 133 if (location.IsRegister()) { | 134 if (location.IsRegister()) { |
| 134 return ExplicitOperand(LocationOperand::REGISTER, rep, | 135 return ExplicitOperand(LocationOperand::REGISTER, rep, |
| 135 location.AsRegister()); | 136 location.AsRegister()); |
| 136 } else { | 137 } else { |
| 137 return ExplicitOperand(LocationOperand::STACK_SLOT, rep, | 138 return ExplicitOperand(LocationOperand::STACK_SLOT, rep, |
| 138 location.GetLocation()); | 139 location.GetLocation()); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 return UnallocatedOperand(UnallocatedOperand::FIXED_SLOT, | 268 return UnallocatedOperand(UnallocatedOperand::FIXED_SLOT, |
| 268 location.AsCallerFrameSlot(), virtual_register); | 269 location.AsCallerFrameSlot(), virtual_register); |
| 269 } | 270 } |
| 270 if (location.IsCalleeFrameSlot()) { | 271 if (location.IsCalleeFrameSlot()) { |
| 271 // a spill location on this (callee) frame. | 272 // a spill location on this (callee) frame. |
| 272 return UnallocatedOperand(UnallocatedOperand::FIXED_SLOT, | 273 return UnallocatedOperand(UnallocatedOperand::FIXED_SLOT, |
| 273 location.AsCalleeFrameSlot(), virtual_register); | 274 location.AsCalleeFrameSlot(), virtual_register); |
| 274 } | 275 } |
| 275 // a fixed register. | 276 // a fixed register. |
| 276 if (IsFloatingPoint(rep)) { | 277 if (IsFloatingPoint(rep)) { |
| 277 return UnallocatedOperand(UnallocatedOperand::FIXED_DOUBLE_REGISTER, | 278 return UnallocatedOperand(UnallocatedOperand::FIXED_FP_REGISTER, |
| 278 location.AsRegister(), virtual_register); | 279 location.AsRegister(), virtual_register); |
| 279 } | 280 } |
| 280 return UnallocatedOperand(UnallocatedOperand::FIXED_REGISTER, | 281 return UnallocatedOperand(UnallocatedOperand::FIXED_REGISTER, |
| 281 location.AsRegister(), virtual_register); | 282 location.AsRegister(), virtual_register); |
| 282 } | 283 } |
| 283 | 284 |
| 284 InstructionSelector* selector_; | 285 InstructionSelector* selector_; |
| 285 }; | 286 }; |
| 286 | 287 |
| 287 | 288 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 // or mode_ == kFlags_set. | 383 // or mode_ == kFlags_set. |
| 383 BasicBlock* true_block_; // Only valid if mode_ == kFlags_branch. | 384 BasicBlock* true_block_; // Only valid if mode_ == kFlags_branch. |
| 384 BasicBlock* false_block_; // Only valid if mode_ == kFlags_branch. | 385 BasicBlock* false_block_; // Only valid if mode_ == kFlags_branch. |
| 385 }; | 386 }; |
| 386 | 387 |
| 387 } // namespace compiler | 388 } // namespace compiler |
| 388 } // namespace internal | 389 } // namespace internal |
| 389 } // namespace v8 | 390 } // namespace v8 |
| 390 | 391 |
| 391 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ | 392 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ |
| OLD | NEW |