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

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

Issue 1513543003: [turbofan] Make MachineType a pair of enums. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Moar rebase 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/raw-machine-assembler.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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 bool IsTopLevel() const; 308 bool IsTopLevel() const;
309 309
310 LiveRange* next() const { return next_; } 310 LiveRange* next() const { return next_; }
311 311
312 int relative_id() const { return relative_id_; } 312 int relative_id() const { return relative_id_; }
313 313
314 bool IsEmpty() const { return first_interval() == nullptr; } 314 bool IsEmpty() const { return first_interval() == nullptr; }
315 315
316 InstructionOperand GetAssignedOperand() const; 316 InstructionOperand GetAssignedOperand() const;
317 317
318 MachineType machine_type() const { return MachineTypeField::decode(bits_); } 318 MachineRepresentation representation() const {
319 return RepresentationField::decode(bits_);
320 }
319 321
320 int assigned_register() const { return AssignedRegisterField::decode(bits_); } 322 int assigned_register() const { return AssignedRegisterField::decode(bits_); }
321 bool HasRegisterAssigned() const { 323 bool HasRegisterAssigned() const {
322 return assigned_register() != kUnassignedRegister; 324 return assigned_register() != kUnassignedRegister;
323 } 325 }
324 void set_assigned_register(int reg); 326 void set_assigned_register(int reg);
325 void UnsetAssignedRegister(); 327 void UnsetAssignedRegister();
326 328
327 bool spilled() const { return SpilledField::decode(bits_); } 329 bool spilled() const { return SpilledField::decode(bits_); }
328 void Spill(); 330 void Spill();
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 void set_weight(float weight) { weight_ = weight; } 409 void set_weight(float weight) { weight_ = weight; }
408 LiveRangeGroup* group() const { return group_; } 410 LiveRangeGroup* group() const { return group_; }
409 void set_group(LiveRangeGroup* group) { group_ = group; } 411 void set_group(LiveRangeGroup* group) { group_ = group; }
410 412
411 static const int kInvalidSize = -1; 413 static const int kInvalidSize = -1;
412 static const float kInvalidWeight; 414 static const float kInvalidWeight;
413 static const float kMaxWeight; 415 static const float kMaxWeight;
414 416
415 private: 417 private:
416 friend class TopLevelLiveRange; 418 friend class TopLevelLiveRange;
417 explicit LiveRange(int relative_id, MachineType machine_type, 419 explicit LiveRange(int relative_id, MachineRepresentation rep,
418 TopLevelLiveRange* top_level); 420 TopLevelLiveRange* top_level);
419 421
420 void AppendAsChild(TopLevelLiveRange* other); 422 void AppendAsChild(TopLevelLiveRange* other);
421 void UpdateParentForAllChildren(TopLevelLiveRange* new_top_level); 423 void UpdateParentForAllChildren(TopLevelLiveRange* new_top_level);
422 424
423 void set_spilled(bool value) { bits_ = SpilledField::update(bits_, value); } 425 void set_spilled(bool value) { bits_ = SpilledField::update(bits_, value); }
424 426
425 UseInterval* FirstSearchIntervalForPosition(LifetimePosition position) const; 427 UseInterval* FirstSearchIntervalForPosition(LifetimePosition position) const;
426 void AdvanceLastProcessedMarker(UseInterval* to_start_of, 428 void AdvanceLastProcessedMarker(UseInterval* to_start_of,
427 LifetimePosition but_not_past) const; 429 LifetimePosition but_not_past) const;
428 430
429 typedef BitField<bool, 0, 1> SpilledField; 431 typedef BitField<bool, 0, 1> SpilledField;
430 typedef BitField<int32_t, 6, 6> AssignedRegisterField; 432 typedef BitField<int32_t, 6, 6> AssignedRegisterField;
431 typedef BitField<MachineType, 12, 15> MachineTypeField; 433 typedef BitField<MachineRepresentation, 12, 15> RepresentationField;
432 434
433 // Unique among children and splinters of the same virtual register. 435 // Unique among children and splinters of the same virtual register.
434 int relative_id_; 436 int relative_id_;
435 uint32_t bits_; 437 uint32_t bits_;
436 UseInterval* last_interval_; 438 UseInterval* last_interval_;
437 UseInterval* first_interval_; 439 UseInterval* first_interval_;
438 UsePosition* first_pos_; 440 UsePosition* first_pos_;
439 TopLevelLiveRange* top_level_; 441 TopLevelLiveRange* top_level_;
440 LiveRange* next_; 442 LiveRange* next_;
441 // This is used as a cache, it doesn't affect correctness. 443 // This is used as a cache, it doesn't affect correctness.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 476
475 private: 477 private:
476 ZoneVector<LiveRange*> ranges_; 478 ZoneVector<LiveRange*> ranges_;
477 int assigned_register_; 479 int assigned_register_;
478 DISALLOW_COPY_AND_ASSIGN(LiveRangeGroup); 480 DISALLOW_COPY_AND_ASSIGN(LiveRangeGroup);
479 }; 481 };
480 482
481 483
482 class TopLevelLiveRange final : public LiveRange { 484 class TopLevelLiveRange final : public LiveRange {
483 public: 485 public:
484 explicit TopLevelLiveRange(int vreg, MachineType machine_type); 486 explicit TopLevelLiveRange(int vreg, MachineRepresentation rep);
485 int spill_start_index() const { return spill_start_index_; } 487 int spill_start_index() const { return spill_start_index_; }
486 488
487 bool IsFixed() const { return vreg_ < 0; } 489 bool IsFixed() const { return vreg_ < 0; }
488 490
489 bool is_phi() const { return IsPhiField::decode(bits_); } 491 bool is_phi() const { return IsPhiField::decode(bits_); }
490 void set_is_phi(bool value) { bits_ = IsPhiField::update(bits_, value); } 492 void set_is_phi(bool value) { bits_ = IsPhiField::update(bits_, value); }
491 493
492 bool is_non_loop_phi() const { return IsNonLoopPhiField::decode(bits_); } 494 bool is_non_loop_phi() const { return IsNonLoopPhiField::decode(bits_); }
493 void set_is_non_loop_phi(bool value) { 495 void set_is_non_loop_phi(bool value) {
494 bits_ = IsNonLoopPhiField::update(bits_, value); 496 bits_ = IsNonLoopPhiField::update(bits_, value);
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 // This zone is for datastructures only needed during register allocation 768 // This zone is for datastructures only needed during register allocation
767 // phases. 769 // phases.
768 Zone* allocation_zone() const { return allocation_zone_; } 770 Zone* allocation_zone() const { return allocation_zone_; }
769 // This zone is for InstructionOperands and moves that live beyond register 771 // This zone is for InstructionOperands and moves that live beyond register
770 // allocation. 772 // allocation.
771 Zone* code_zone() const { return code()->zone(); } 773 Zone* code_zone() const { return code()->zone(); }
772 Frame* frame() const { return frame_; } 774 Frame* frame() const { return frame_; }
773 const char* debug_name() const { return debug_name_; } 775 const char* debug_name() const { return debug_name_; }
774 const RegisterConfiguration* config() const { return config_; } 776 const RegisterConfiguration* config() const { return config_; }
775 777
776 MachineType MachineTypeFor(int virtual_register); 778 MachineRepresentation RepresentationFor(int virtual_register);
777 779
778 TopLevelLiveRange* GetOrCreateLiveRangeFor(int index); 780 TopLevelLiveRange* GetOrCreateLiveRangeFor(int index);
779 // Creates a new live range. 781 // Creates a new live range.
780 TopLevelLiveRange* NewLiveRange(int index, MachineType machine_type); 782 TopLevelLiveRange* NewLiveRange(int index, MachineRepresentation rep);
781 TopLevelLiveRange* NextLiveRange(MachineType machine_type); 783 TopLevelLiveRange* NextLiveRange(MachineRepresentation rep);
782 784
783 SpillRange* AssignSpillRangeToLiveRange(TopLevelLiveRange* range); 785 SpillRange* AssignSpillRangeToLiveRange(TopLevelLiveRange* range);
784 SpillRange* CreateSpillRangeForLiveRange(TopLevelLiveRange* range); 786 SpillRange* CreateSpillRangeForLiveRange(TopLevelLiveRange* range);
785 787
786 MoveOperands* AddGapMove(int index, Instruction::GapPosition position, 788 MoveOperands* AddGapMove(int index, Instruction::GapPosition position,
787 const InstructionOperand& from, 789 const InstructionOperand& from,
788 const InstructionOperand& to); 790 const InstructionOperand& to);
789 791
790 bool IsReference(TopLevelLiveRange* top_range) const { 792 bool IsReference(TopLevelLiveRange* top_range) const {
791 return code()->IsReference(top_range->vreg()); 793 return code()->IsReference(top_range->vreg());
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 RegisterAllocationData* const data_; 1147 RegisterAllocationData* const data_;
1146 1148
1147 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector); 1149 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector);
1148 }; 1150 };
1149 1151
1150 } // namespace compiler 1152 } // namespace compiler
1151 } // namespace internal 1153 } // namespace internal
1152 } // namespace v8 1154 } // namespace v8
1153 1155
1154 #endif // V8_REGISTER_ALLOCATOR_H_ 1156 #endif // V8_REGISTER_ALLOCATOR_H_
OLDNEW
« no previous file with comments | « src/compiler/raw-machine-assembler.cc ('k') | src/compiler/register-allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698