| 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/compiler/instruction.h" | 8 #include "src/compiler/instruction.h" |
| 9 #include "src/zone-containers.h" | 9 #include "src/zone-containers.h" |
| 10 | 10 |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 const ZoneVector<LiveRange*>& fixed_live_ranges() const { | 353 const ZoneVector<LiveRange*>& fixed_live_ranges() const { |
| 354 return fixed_live_ranges_; | 354 return fixed_live_ranges_; |
| 355 } | 355 } |
| 356 const ZoneVector<LiveRange*>& fixed_double_live_ranges() const { | 356 const ZoneVector<LiveRange*>& fixed_double_live_ranges() const { |
| 357 return fixed_double_live_ranges_; | 357 return fixed_double_live_ranges_; |
| 358 } | 358 } |
| 359 InstructionSequence* code() const { return code_; } | 359 InstructionSequence* code() const { return code_; } |
| 360 // This zone is for datastructures only needed during register allocation. | 360 // This zone is for datastructures only needed during register allocation. |
| 361 Zone* local_zone() const { return local_zone_; } | 361 Zone* local_zone() const { return local_zone_; } |
| 362 | 362 |
| 363 bool use_spill_ranges() const { return use_spill_ranges_; } |
| 364 |
| 363 // Phase 1 : insert moves to account for fixed register operands. | 365 // Phase 1 : insert moves to account for fixed register operands. |
| 364 void MeetRegisterConstraints(); | 366 void MeetRegisterConstraints(); |
| 365 | 367 |
| 366 // Phase 2: compute liveness of all virtual register. | 368 // Phase 2: compute liveness of all virtual register. |
| 367 void BuildLiveRanges(); | 369 void BuildLiveRanges(); |
| 368 bool ExistsUseWithoutDefinition(); | 370 bool ExistsUseWithoutDefinition(); |
| 369 | 371 |
| 370 // Phase 3: compute register assignments. | 372 // Phase 3: compute register assignments. |
| 371 void AllocateGeneralRegisters(); | 373 void AllocateGeneralRegisters(); |
| 372 void AllocateDoubleRegisters(); | 374 void AllocateDoubleRegisters(); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 bool UnhandledIsSorted(); | 452 bool UnhandledIsSorted(); |
| 451 void ActiveToHandled(LiveRange* range); | 453 void ActiveToHandled(LiveRange* range); |
| 452 void ActiveToInactive(LiveRange* range); | 454 void ActiveToInactive(LiveRange* range); |
| 453 void InactiveToHandled(LiveRange* range); | 455 void InactiveToHandled(LiveRange* range); |
| 454 void InactiveToActive(LiveRange* range); | 456 void InactiveToActive(LiveRange* range); |
| 455 | 457 |
| 456 // Helper methods for allocating registers. | 458 // Helper methods for allocating registers. |
| 457 bool TryAllocateFreeReg(LiveRange* range); | 459 bool TryAllocateFreeReg(LiveRange* range); |
| 458 void AllocateBlockedReg(LiveRange* range); | 460 void AllocateBlockedReg(LiveRange* range); |
| 459 SpillRange* AssignSpillRangeToLiveRange(LiveRange* range); | 461 SpillRange* AssignSpillRangeToLiveRange(LiveRange* range); |
| 462 void FreeSpillSlot(LiveRange* range); |
| 463 InstructionOperand* TryReuseSpillSlot(LiveRange* range); |
| 460 | 464 |
| 461 // Live range splitting helpers. | 465 // Live range splitting helpers. |
| 462 | 466 |
| 463 // Split the given range at the given position. | 467 // Split the given range at the given position. |
| 464 // If range starts at or after the given position then the | 468 // If range starts at or after the given position then the |
| 465 // original range is returned. | 469 // original range is returned. |
| 466 // Otherwise returns the live range that starts at pos and contains | 470 // Otherwise returns the live range that starts at pos and contains |
| 467 // all uses from the original range that follow pos. Uses at pos will | 471 // all uses from the original range that follow pos. Uses at pos will |
| 468 // still be owned by the original range after splitting. | 472 // still be owned by the original range after splitting. |
| 469 LiveRange* SplitRangeAt(LiveRange* range, LifetimePosition pos); | 473 LiveRange* SplitRangeAt(LiveRange* range, LifetimePosition pos); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 ZoneList<SpillRange*> spill_ranges_; | 560 ZoneList<SpillRange*> spill_ranges_; |
| 557 | 561 |
| 558 RegisterKind mode_; | 562 RegisterKind mode_; |
| 559 int num_registers_; | 563 int num_registers_; |
| 560 | 564 |
| 561 BitVector* assigned_registers_; | 565 BitVector* assigned_registers_; |
| 562 BitVector* assigned_double_registers_; | 566 BitVector* assigned_double_registers_; |
| 563 | 567 |
| 564 // Indicates success or failure during register allocation. | 568 // Indicates success or failure during register allocation. |
| 565 bool allocation_ok_; | 569 bool allocation_ok_; |
| 570 bool use_spill_ranges_; |
| 566 | 571 |
| 567 #ifdef DEBUG | 572 #ifdef DEBUG |
| 568 LifetimePosition allocation_finger_; | 573 LifetimePosition allocation_finger_; |
| 569 #endif | 574 #endif |
| 570 | 575 |
| 571 DISALLOW_COPY_AND_ASSIGN(RegisterAllocator); | 576 DISALLOW_COPY_AND_ASSIGN(RegisterAllocator); |
| 572 }; | 577 }; |
| 573 | 578 |
| 574 } | 579 } |
| 575 } | 580 } |
| 576 } // namespace v8::internal::compiler | 581 } // namespace v8::internal::compiler |
| 577 | 582 |
| 578 #endif // V8_REGISTER_ALLOCATOR_H_ | 583 #endif // V8_REGISTER_ALLOCATOR_H_ |
| OLD | NEW |