Chromium Code Reviews| 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(from_location, kMachPtr)); | |
|
Benedikt Meurer
2015/11/20 10:06:43
Is kMachPtr really what you want here? Shouldn't i
danno
2015/11/20 14:43:23
Done.
| |
| 158 selector_->Emit(kArchNop, casted_from_operand); | |
| 159 return ToUnallocatedOperand(to_location, type, | |
| 160 casted_from_operand.virtual_register()); | |
| 161 } | |
| 162 | |
| 145 InstructionOperand TempRegister() { | 163 InstructionOperand TempRegister() { |
| 146 return UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, | 164 return UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER, |
| 147 UnallocatedOperand::USED_AT_START, | 165 UnallocatedOperand::USED_AT_START, |
| 148 sequence()->NextVirtualRegister()); | 166 sequence()->NextVirtualRegister()); |
| 149 } | 167 } |
| 150 | 168 |
| 151 InstructionOperand TempDoubleRegister() { | 169 InstructionOperand TempDoubleRegister() { |
| 152 UnallocatedOperand op = UnallocatedOperand( | 170 UnallocatedOperand op = UnallocatedOperand( |
| 153 UnallocatedOperand::MUST_HAVE_REGISTER, | 171 UnallocatedOperand::MUST_HAVE_REGISTER, |
| 154 UnallocatedOperand::USED_AT_START, sequence()->NextVirtualRegister()); | 172 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. | 359 Node* result_; // Only valid if mode_ == kFlags_set. |
| 342 BasicBlock* true_block_; // Only valid if mode_ == kFlags_branch. | 360 BasicBlock* true_block_; // Only valid if mode_ == kFlags_branch. |
| 343 BasicBlock* false_block_; // Only valid if mode_ == kFlags_branch. | 361 BasicBlock* false_block_; // Only valid if mode_ == kFlags_branch. |
| 344 }; | 362 }; |
| 345 | 363 |
| 346 } // namespace compiler | 364 } // namespace compiler |
| 347 } // namespace internal | 365 } // namespace internal |
| 348 } // namespace v8 | 366 } // namespace v8 |
| 349 | 367 |
| 350 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ | 368 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ |
| OLD | NEW |