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_REGISTER_ALLOCATOR_H_ | 5 #ifndef V8_REGISTER_ALLOCATOR_H_ |
6 #define V8_REGISTER_ALLOCATOR_H_ | 6 #define V8_REGISTER_ALLOCATOR_H_ |
7 | 7 |
| 8 #include "src/base/compiler-specific.h" |
8 #include "src/compiler/instruction.h" | 9 #include "src/compiler/instruction.h" |
| 10 #include "src/globals.h" |
9 #include "src/ostreams.h" | 11 #include "src/ostreams.h" |
10 #include "src/register-configuration.h" | 12 #include "src/register-configuration.h" |
11 #include "src/zone/zone-containers.h" | 13 #include "src/zone/zone-containers.h" |
12 | 14 |
13 namespace v8 { | 15 namespace v8 { |
14 namespace internal { | 16 namespace internal { |
15 namespace compiler { | 17 namespace compiler { |
16 | 18 |
17 enum RegisterKind { GENERAL_REGISTERS, FP_REGISTERS }; | 19 enum RegisterKind { GENERAL_REGISTERS, FP_REGISTERS }; |
18 | 20 |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 }; | 241 }; |
240 | 242 |
241 | 243 |
242 static const int32_t kUnassignedRegister = | 244 static const int32_t kUnassignedRegister = |
243 RegisterConfiguration::kMaxGeneralRegisters; | 245 RegisterConfiguration::kMaxGeneralRegisters; |
244 | 246 |
245 static_assert(kUnassignedRegister <= RegisterConfiguration::kMaxFPRegisters, | 247 static_assert(kUnassignedRegister <= RegisterConfiguration::kMaxFPRegisters, |
246 "kUnassignedRegister too small"); | 248 "kUnassignedRegister too small"); |
247 | 249 |
248 // Representation of a use position. | 250 // Representation of a use position. |
249 class UsePosition final : public ZoneObject { | 251 class V8_EXPORT_PRIVATE UsePosition final |
| 252 : public NON_EXPORTED_BASE(ZoneObject) { |
250 public: | 253 public: |
251 UsePosition(LifetimePosition pos, InstructionOperand* operand, void* hint, | 254 UsePosition(LifetimePosition pos, InstructionOperand* operand, void* hint, |
252 UsePositionHintType hint_type); | 255 UsePositionHintType hint_type); |
253 | 256 |
254 InstructionOperand* operand() const { return operand_; } | 257 InstructionOperand* operand() const { return operand_; } |
255 bool HasOperand() const { return operand_ != nullptr; } | 258 bool HasOperand() const { return operand_ != nullptr; } |
256 | 259 |
257 bool RegisterIsBeneficial() const { | 260 bool RegisterIsBeneficial() const { |
258 return RegisterBeneficialField::decode(flags_); | 261 return RegisterBeneficialField::decode(flags_); |
259 } | 262 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 }; | 301 }; |
299 | 302 |
300 | 303 |
301 class SpillRange; | 304 class SpillRange; |
302 class RegisterAllocationData; | 305 class RegisterAllocationData; |
303 class TopLevelLiveRange; | 306 class TopLevelLiveRange; |
304 class LiveRangeGroup; | 307 class LiveRangeGroup; |
305 | 308 |
306 // Representation of SSA values' live ranges as a collection of (continuous) | 309 // Representation of SSA values' live ranges as a collection of (continuous) |
307 // intervals over the instruction ordering. | 310 // intervals over the instruction ordering. |
308 class LiveRange : public ZoneObject { | 311 class V8_EXPORT_PRIVATE LiveRange : public NON_EXPORTED_BASE(ZoneObject) { |
309 public: | 312 public: |
310 UseInterval* first_interval() const { return first_interval_; } | 313 UseInterval* first_interval() const { return first_interval_; } |
311 UsePosition* first_pos() const { return first_pos_; } | 314 UsePosition* first_pos() const { return first_pos_; } |
312 TopLevelLiveRange* TopLevel() { return top_level_; } | 315 TopLevelLiveRange* TopLevel() { return top_level_; } |
313 const TopLevelLiveRange* TopLevel() const { return top_level_; } | 316 const TopLevelLiveRange* TopLevel() const { return top_level_; } |
314 | 317 |
315 bool IsTopLevel() const; | 318 bool IsTopLevel() const; |
316 | 319 |
317 LiveRange* next() const { return next_; } | 320 LiveRange* next() const { return next_; } |
318 | 321 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 | 472 |
470 int assigned_register() const { return assigned_register_; } | 473 int assigned_register() const { return assigned_register_; } |
471 void set_assigned_register(int reg) { assigned_register_ = reg; } | 474 void set_assigned_register(int reg) { assigned_register_ = reg; } |
472 | 475 |
473 private: | 476 private: |
474 ZoneVector<LiveRange*> ranges_; | 477 ZoneVector<LiveRange*> ranges_; |
475 int assigned_register_; | 478 int assigned_register_; |
476 DISALLOW_COPY_AND_ASSIGN(LiveRangeGroup); | 479 DISALLOW_COPY_AND_ASSIGN(LiveRangeGroup); |
477 }; | 480 }; |
478 | 481 |
479 | 482 class V8_EXPORT_PRIVATE TopLevelLiveRange final : public LiveRange { |
480 class TopLevelLiveRange final : public LiveRange { | |
481 public: | 483 public: |
482 explicit TopLevelLiveRange(int vreg, MachineRepresentation rep); | 484 explicit TopLevelLiveRange(int vreg, MachineRepresentation rep); |
483 int spill_start_index() const { return spill_start_index_; } | 485 int spill_start_index() const { return spill_start_index_; } |
484 | 486 |
485 bool IsFixed() const { return vreg_ < 0; } | 487 bool IsFixed() const { return vreg_ < 0; } |
486 | 488 |
487 bool is_phi() const { return IsPhiField::decode(bits_); } | 489 bool is_phi() const { return IsPhiField::decode(bits_); } |
488 void set_is_phi(bool value) { bits_ = IsPhiField::update(bits_, value); } | 490 void set_is_phi(bool value) { bits_ = IsPhiField::update(bits_, value); } |
489 | 491 |
490 bool is_non_loop_phi() const { return IsNonLoopPhiField::decode(bits_); } | 492 bool is_non_loop_phi() const { return IsNonLoopPhiField::decode(bits_); } |
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1180 RegisterAllocationData* const data_; | 1182 RegisterAllocationData* const data_; |
1181 | 1183 |
1182 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector); | 1184 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector); |
1183 }; | 1185 }; |
1184 | 1186 |
1185 } // namespace compiler | 1187 } // namespace compiler |
1186 } // namespace internal | 1188 } // namespace internal |
1187 } // namespace v8 | 1189 } // namespace v8 |
1188 | 1190 |
1189 #endif // V8_REGISTER_ALLOCATOR_H_ | 1191 #endif // V8_REGISTER_ALLOCATOR_H_ |
OLD | NEW |