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 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 void CommitAssignment(const InstructionOperand& operand); | 521 void CommitAssignment(const InstructionOperand& operand); |
522 | 522 |
523 private: | 523 private: |
524 PhiInstruction* const phi_; | 524 PhiInstruction* const phi_; |
525 const InstructionBlock* const block_; | 525 const InstructionBlock* const block_; |
526 ZoneVector<InstructionOperand*> incoming_operands_; | 526 ZoneVector<InstructionOperand*> incoming_operands_; |
527 int assigned_register_; | 527 int assigned_register_; |
528 }; | 528 }; |
529 typedef ZoneMap<int, PhiMapValue*> PhiMap; | 529 typedef ZoneMap<int, PhiMapValue*> PhiMap; |
530 | 530 |
| 531 struct DelayedReference { |
| 532 ReferenceMap* map; |
| 533 InstructionOperand* operand; |
| 534 }; |
| 535 typedef ZoneVector<DelayedReference> DelayedReferences; |
| 536 |
531 RegisterAllocationData(const RegisterConfiguration* config, | 537 RegisterAllocationData(const RegisterConfiguration* config, |
532 Zone* allocation_zone, Frame* frame, | 538 Zone* allocation_zone, Frame* frame, |
533 InstructionSequence* code, | 539 InstructionSequence* code, |
534 const char* debug_name = nullptr); | 540 const char* debug_name = nullptr); |
535 | 541 |
536 const ZoneVector<LiveRange*>& live_ranges() const { return live_ranges_; } | 542 const ZoneVector<LiveRange*>& live_ranges() const { return live_ranges_; } |
537 ZoneVector<LiveRange*>& live_ranges() { return live_ranges_; } | 543 ZoneVector<LiveRange*>& live_ranges() { return live_ranges_; } |
538 const ZoneVector<LiveRange*>& fixed_live_ranges() const { | 544 const ZoneVector<LiveRange*>& fixed_live_ranges() const { |
539 return fixed_live_ranges_; | 545 return fixed_live_ranges_; |
540 } | 546 } |
541 ZoneVector<LiveRange*>& fixed_live_ranges() { return fixed_live_ranges_; } | 547 ZoneVector<LiveRange*>& fixed_live_ranges() { return fixed_live_ranges_; } |
542 ZoneVector<LiveRange*>& fixed_double_live_ranges() { | 548 ZoneVector<LiveRange*>& fixed_double_live_ranges() { |
543 return fixed_double_live_ranges_; | 549 return fixed_double_live_ranges_; |
544 } | 550 } |
545 const ZoneVector<LiveRange*>& fixed_double_live_ranges() const { | 551 const ZoneVector<LiveRange*>& fixed_double_live_ranges() const { |
546 return fixed_double_live_ranges_; | 552 return fixed_double_live_ranges_; |
547 } | 553 } |
548 ZoneVector<BitVector*>& live_in_sets() { return live_in_sets_; } | 554 ZoneVector<BitVector*>& live_in_sets() { return live_in_sets_; } |
549 ZoneVector<SpillRange*>& spill_ranges() { return spill_ranges_; } | 555 ZoneVector<SpillRange*>& spill_ranges() { return spill_ranges_; } |
| 556 DelayedReferences& delayed_references() { return delayed_references_; } |
550 InstructionSequence* code() const { return code_; } | 557 InstructionSequence* code() const { return code_; } |
551 // This zone is for datastructures only needed during register allocation | 558 // This zone is for datastructures only needed during register allocation |
552 // phases. | 559 // phases. |
553 Zone* allocation_zone() const { return allocation_zone_; } | 560 Zone* allocation_zone() const { return allocation_zone_; } |
554 // This zone is for InstructionOperands and moves that live beyond register | 561 // This zone is for InstructionOperands and moves that live beyond register |
555 // allocation. | 562 // allocation. |
556 Zone* code_zone() const { return code()->zone(); } | 563 Zone* code_zone() const { return code()->zone(); } |
557 Frame* frame() const { return frame_; } | 564 Frame* frame() const { return frame_; } |
558 const char* debug_name() const { return debug_name_; } | 565 const char* debug_name() const { return debug_name_; } |
559 const RegisterConfiguration* config() const { return config_; } | 566 const RegisterConfiguration* config() const { return config_; } |
(...skipping 28 matching lines...) Expand all Loading... |
588 Frame* const frame_; | 595 Frame* const frame_; |
589 InstructionSequence* const code_; | 596 InstructionSequence* const code_; |
590 const char* const debug_name_; | 597 const char* const debug_name_; |
591 const RegisterConfiguration* const config_; | 598 const RegisterConfiguration* const config_; |
592 PhiMap phi_map_; | 599 PhiMap phi_map_; |
593 ZoneVector<BitVector*> live_in_sets_; | 600 ZoneVector<BitVector*> live_in_sets_; |
594 ZoneVector<LiveRange*> live_ranges_; | 601 ZoneVector<LiveRange*> live_ranges_; |
595 ZoneVector<LiveRange*> fixed_live_ranges_; | 602 ZoneVector<LiveRange*> fixed_live_ranges_; |
596 ZoneVector<LiveRange*> fixed_double_live_ranges_; | 603 ZoneVector<LiveRange*> fixed_double_live_ranges_; |
597 ZoneVector<SpillRange*> spill_ranges_; | 604 ZoneVector<SpillRange*> spill_ranges_; |
| 605 DelayedReferences delayed_references_; |
598 BitVector* assigned_registers_; | 606 BitVector* assigned_registers_; |
599 BitVector* assigned_double_registers_; | 607 BitVector* assigned_double_registers_; |
600 int virtual_register_count_; | 608 int virtual_register_count_; |
601 | 609 |
602 DISALLOW_COPY_AND_ASSIGN(RegisterAllocationData); | 610 DISALLOW_COPY_AND_ASSIGN(RegisterAllocationData); |
603 }; | 611 }; |
604 | 612 |
605 | 613 |
606 class ConstraintBuilder final : public ZoneObject { | 614 class ConstraintBuilder final : public ZoneObject { |
607 public: | 615 public: |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
916 RegisterAllocationData* const data_; | 924 RegisterAllocationData* const data_; |
917 | 925 |
918 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector); | 926 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector); |
919 }; | 927 }; |
920 | 928 |
921 } // namespace compiler | 929 } // namespace compiler |
922 } // namespace internal | 930 } // namespace internal |
923 } // namespace v8 | 931 } // namespace v8 |
924 | 932 |
925 #endif // V8_REGISTER_ALLOCATOR_H_ | 933 #endif // V8_REGISTER_ALLOCATOR_H_ |
OLD | NEW |