Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: src/compiler/register-allocator.h

Issue 1528983005: [turbofan] Print APIs for live ranges. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/instruction.cc ('k') | src/compiler/register-allocator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 } 128 }
129 129
130 bool operator>(const LifetimePosition& that) const { 130 bool operator>(const LifetimePosition& that) const {
131 return this->value_ > that.value_; 131 return this->value_ > that.value_;
132 } 132 }
133 133
134 bool operator>=(const LifetimePosition& that) const { 134 bool operator>=(const LifetimePosition& that) const {
135 return this->value_ >= that.value_; 135 return this->value_ >= that.value_;
136 } 136 }
137 137
138 void Print() const;
139
138 static inline LifetimePosition Invalid() { return LifetimePosition(); } 140 static inline LifetimePosition Invalid() { return LifetimePosition(); }
139 141
140 static inline LifetimePosition MaxPosition() { 142 static inline LifetimePosition MaxPosition() {
141 // We have to use this kind of getter instead of static member due to 143 // We have to use this kind of getter instead of static member due to
142 // crash bug in GDB. 144 // crash bug in GDB.
143 return LifetimePosition(kMaxInt); 145 return LifetimePosition(kMaxInt);
144 } 146 }
145 147
146 static inline LifetimePosition FromInt(int value) { 148 static inline LifetimePosition FromInt(int value) {
147 return LifetimePosition(value); 149 return LifetimePosition(value);
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 const InstructionOperand& spill_op); 404 const InstructionOperand& spill_op);
403 void SetUseHints(int register_index); 405 void SetUseHints(int register_index);
404 void UnsetUseHints() { SetUseHints(kUnassignedRegister); } 406 void UnsetUseHints() { SetUseHints(kUnassignedRegister); }
405 407
406 // Used solely by the Greedy Allocator: 408 // Used solely by the Greedy Allocator:
407 unsigned GetSize(); 409 unsigned GetSize();
408 float weight() const { return weight_; } 410 float weight() const { return weight_; }
409 void set_weight(float weight) { weight_ = weight; } 411 void set_weight(float weight) { weight_ = weight; }
410 LiveRangeGroup* group() const { return group_; } 412 LiveRangeGroup* group() const { return group_; }
411 void set_group(LiveRangeGroup* group) { group_ = group; } 413 void set_group(LiveRangeGroup* group) { group_ = group; }
414 void Print(const RegisterConfiguration* config, bool with_children) const;
415 void Print(bool with_children) const;
412 416
413 static const int kInvalidSize = -1; 417 static const int kInvalidSize = -1;
414 static const float kInvalidWeight; 418 static const float kInvalidWeight;
415 static const float kMaxWeight; 419 static const float kMaxWeight;
416 420
417 private: 421 private:
418 friend class TopLevelLiveRange; 422 friend class TopLevelLiveRange;
419 explicit LiveRange(int relative_id, MachineRepresentation rep, 423 explicit LiveRange(int relative_id, MachineRepresentation rep,
420 TopLevelLiveRange* top_level); 424 TopLevelLiveRange* top_level);
421 425
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 int assigned_slot() { 685 int assigned_slot() {
682 DCHECK_NE(kUnassignedSlot, assigned_slot_); 686 DCHECK_NE(kUnassignedSlot, assigned_slot_);
683 return assigned_slot_; 687 return assigned_slot_;
684 } 688 }
685 const ZoneVector<TopLevelLiveRange*>& live_ranges() const { 689 const ZoneVector<TopLevelLiveRange*>& live_ranges() const {
686 return live_ranges_; 690 return live_ranges_;
687 } 691 }
688 ZoneVector<TopLevelLiveRange*>& live_ranges() { return live_ranges_; } 692 ZoneVector<TopLevelLiveRange*>& live_ranges() { return live_ranges_; }
689 int byte_width() const { return byte_width_; } 693 int byte_width() const { return byte_width_; }
690 RegisterKind kind() const { return kind_; } 694 RegisterKind kind() const { return kind_; }
695 void Print() const;
691 696
692 private: 697 private:
693 LifetimePosition End() const { return end_position_; } 698 LifetimePosition End() const { return end_position_; }
694 bool IsIntersectingWith(SpillRange* other) const; 699 bool IsIntersectingWith(SpillRange* other) const;
695 // Merge intervals, making sure the use intervals are sorted 700 // Merge intervals, making sure the use intervals are sorted
696 void MergeDisjointIntervals(UseInterval* other); 701 void MergeDisjointIntervals(UseInterval* other);
697 702
698 ZoneVector<TopLevelLiveRange*> live_ranges_; 703 ZoneVector<TopLevelLiveRange*> live_ranges_;
699 UseInterval* use_interval_; 704 UseInterval* use_interval_;
700 LifetimePosition end_position_; 705 LifetimePosition end_position_;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 PhiMapValue* InitializePhiMap(const InstructionBlock* block, 809 PhiMapValue* InitializePhiMap(const InstructionBlock* block,
805 PhiInstruction* phi); 810 PhiInstruction* phi);
806 PhiMapValue* GetPhiMapValueFor(TopLevelLiveRange* top_range); 811 PhiMapValue* GetPhiMapValueFor(TopLevelLiveRange* top_range);
807 PhiMapValue* GetPhiMapValueFor(int virtual_register); 812 PhiMapValue* GetPhiMapValueFor(int virtual_register);
808 bool IsBlockBoundary(LifetimePosition pos) const; 813 bool IsBlockBoundary(LifetimePosition pos) const;
809 814
810 RangesWithPreassignedSlots& preassigned_slot_ranges() { 815 RangesWithPreassignedSlots& preassigned_slot_ranges() {
811 return preassigned_slot_ranges_; 816 return preassigned_slot_ranges_;
812 } 817 }
813 818
814 void Print(const InstructionSequence* instructionSequence);
815 void Print(const Instruction* instruction);
816 void Print(const LiveRange* range, bool with_children = false);
817 void Print(const InstructionOperand& op);
818 void Print(const MoveOperands* move);
819 void Print(const SpillRange* spill_range);
820
821 private: 819 private:
822 int GetNextLiveRangeId(); 820 int GetNextLiveRangeId();
823 821
824 Zone* const allocation_zone_; 822 Zone* const allocation_zone_;
825 Frame* const frame_; 823 Frame* const frame_;
826 InstructionSequence* const code_; 824 InstructionSequence* const code_;
827 const char* const debug_name_; 825 const char* const debug_name_;
828 const RegisterConfiguration* const config_; 826 const RegisterConfiguration* const config_;
829 PhiMap phi_map_; 827 PhiMap phi_map_;
830 ZoneVector<int> allocatable_codes_; 828 ZoneVector<int> allocatable_codes_;
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1155 RegisterAllocationData* const data_; 1153 RegisterAllocationData* const data_;
1156 1154
1157 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector); 1155 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector);
1158 }; 1156 };
1159 1157
1160 } // namespace compiler 1158 } // namespace compiler
1161 } // namespace internal 1159 } // namespace internal
1162 } // namespace v8 1160 } // namespace v8
1163 1161
1164 #endif // V8_REGISTER_ALLOCATOR_H_ 1162 #endif // V8_REGISTER_ALLOCATOR_H_
OLDNEW
« no previous file with comments | « src/compiler/instruction.cc ('k') | src/compiler/register-allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698