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_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/ostreams.h" | 9 #include "src/ostreams.h" |
| 10 #include "src/register-configuration.h" | 10 #include "src/register-configuration.h" |
| (...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 766 bool ExistsUseWithoutDefinition(); | 766 bool ExistsUseWithoutDefinition(); |
| 767 | 767 |
| 768 void MarkAllocated(RegisterKind kind, int index); | 768 void MarkAllocated(RegisterKind kind, int index); |
| 769 | 769 |
| 770 PhiMapValue* InitializePhiMap(const InstructionBlock* block, | 770 PhiMapValue* InitializePhiMap(const InstructionBlock* block, |
| 771 PhiInstruction* phi); | 771 PhiInstruction* phi); |
| 772 PhiMapValue* GetPhiMapValueFor(TopLevelLiveRange* top_range); | 772 PhiMapValue* GetPhiMapValueFor(TopLevelLiveRange* top_range); |
| 773 PhiMapValue* GetPhiMapValueFor(int virtual_register); | 773 PhiMapValue* GetPhiMapValueFor(int virtual_register); |
| 774 bool IsBlockBoundary(LifetimePosition pos) const; | 774 bool IsBlockBoundary(LifetimePosition pos) const; |
| 775 | 775 |
| 776 void Print(const InstructionSequence* instructionSequence); | |
| 777 void Print(const Instruction* instruction); | |
| 778 void Print(const LiveRange* range, bool with_children = false); | |
| 779 void Print(const InstructionOperand& op); | |
| 780 void Print(const MoveOperands* move); | |
| 781 void Print(const SpillRange* spill_range); | |
| 782 | |
| 783 private: | 776 private: |
| 784 int GetNextLiveRangeId(); | 777 int GetNextLiveRangeId(); |
| 785 | 778 |
| 786 Zone* const allocation_zone_; | 779 Zone* const allocation_zone_; |
| 787 Frame* const frame_; | 780 Frame* const frame_; |
| 788 InstructionSequence* const code_; | 781 InstructionSequence* const code_; |
| 789 const char* const debug_name_; | 782 const char* const debug_name_; |
| 790 const RegisterConfiguration* const config_; | 783 const RegisterConfiguration* const config_; |
| 791 PhiMap phi_map_; | 784 PhiMap phi_map_; |
| 792 ZoneVector<int> allocatable_codes_; | 785 ZoneVector<int> allocatable_codes_; |
| 793 ZoneVector<int> allocatable_double_codes_; | 786 ZoneVector<int> allocatable_double_codes_; |
| 794 ZoneVector<BitVector*> live_in_sets_; | 787 ZoneVector<BitVector*> live_in_sets_; |
| 795 ZoneVector<BitVector*> live_out_sets_; | 788 ZoneVector<BitVector*> live_out_sets_; |
| 796 ZoneVector<TopLevelLiveRange*> live_ranges_; | 789 ZoneVector<TopLevelLiveRange*> live_ranges_; |
| 797 ZoneVector<TopLevelLiveRange*> fixed_live_ranges_; | 790 ZoneVector<TopLevelLiveRange*> fixed_live_ranges_; |
| 798 ZoneVector<TopLevelLiveRange*> fixed_double_live_ranges_; | 791 ZoneVector<TopLevelLiveRange*> fixed_double_live_ranges_; |
| 799 ZoneVector<SpillRange*> spill_ranges_; | 792 ZoneVector<SpillRange*> spill_ranges_; |
| 800 DelayedReferences delayed_references_; | 793 DelayedReferences delayed_references_; |
| 801 BitVector* assigned_registers_; | 794 BitVector* assigned_registers_; |
| 802 BitVector* assigned_double_registers_; | 795 BitVector* assigned_double_registers_; |
| 803 int virtual_register_count_; | 796 int virtual_register_count_; |
| 804 | 797 |
| 805 DISALLOW_COPY_AND_ASSIGN(RegisterAllocationData); | 798 DISALLOW_COPY_AND_ASSIGN(RegisterAllocationData); |
| 806 }; | 799 }; |
| 807 | 800 |
| 808 | 801 |
| 802 void Print(const RegisterConfiguration* config, | |
| 803 const InstructionSequence* instructionSequence); | |
| 804 void Print(const RegisterConfiguration* config, const Instruction* instruction); | |
| 805 void Print(const RegisterConfiguration* config, const LiveRange* range, | |
| 806 bool with_children = false); | |
| 807 void Print(const RegisterConfiguration* config, const InstructionOperand& op); | |
| 808 void Print(const RegisterConfiguration* config, const MoveOperands* move); | |
| 809 void Print(const RegisterConfiguration* config, const SpillRange* spill_range); | |
|
Jarin
2015/10/29 07:37:25
Why did you move the printing out of the class? We
Mircea Trofin
2015/10/29 14:14:40
I needed to visualize a few things (InstructionSeq
Jarin
2015/10/29 14:32:13
I understand, but why can't you move the printing
| |
| 810 | |
| 811 | |
| 809 class ConstraintBuilder final : public ZoneObject { | 812 class ConstraintBuilder final : public ZoneObject { |
| 810 public: | 813 public: |
| 811 explicit ConstraintBuilder(RegisterAllocationData* data); | 814 explicit ConstraintBuilder(RegisterAllocationData* data); |
| 812 | 815 |
| 813 // Phase 1 : insert moves to account for fixed register operands. | 816 // Phase 1 : insert moves to account for fixed register operands. |
| 814 void MeetRegisterConstraints(); | 817 void MeetRegisterConstraints(); |
| 815 | 818 |
| 816 // Phase 2: deconstruct SSA by inserting moves in successors and the headers | 819 // Phase 2: deconstruct SSA by inserting moves in successors and the headers |
| 817 // of blocks containing phis. | 820 // of blocks containing phis. |
| 818 void ResolvePhis(); | 821 void ResolvePhis(); |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1116 RegisterAllocationData* const data_; | 1119 RegisterAllocationData* const data_; |
| 1117 | 1120 |
| 1118 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector); | 1121 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector); |
| 1119 }; | 1122 }; |
| 1120 | 1123 |
| 1121 } // namespace compiler | 1124 } // namespace compiler |
| 1122 } // namespace internal | 1125 } // namespace internal |
| 1123 } // namespace v8 | 1126 } // namespace v8 |
| 1124 | 1127 |
| 1125 #endif // V8_REGISTER_ALLOCATOR_H_ | 1128 #endif // V8_REGISTER_ALLOCATOR_H_ |
| OLD | NEW |