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

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

Issue 596703004: [turbofan] Add backend support for float32. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE Created 6 years, 3 months 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler/raw-machine-assembler.h ('k') | src/compiler/representation-change.h » ('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 #include "src/compiler/register-allocator.h" 5 #include "src/compiler/register-allocator.h"
6 6
7 #include "src/compiler/linkage.h" 7 #include "src/compiler/linkage.h"
8 #include "src/hydrogen.h" 8 #include "src/hydrogen.h"
9 #include "src/string-stream.h" 9 #include "src/string-stream.h"
10 10
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 DCHECK(result->IsFixed()); 619 DCHECK(result->IsFixed());
620 result->kind_ = GENERAL_REGISTERS; 620 result->kind_ = GENERAL_REGISTERS;
621 SetLiveRangeAssignedRegister(result, index); 621 SetLiveRangeAssignedRegister(result, index);
622 fixed_live_ranges_[index] = result; 622 fixed_live_ranges_[index] = result;
623 } 623 }
624 return result; 624 return result;
625 } 625 }
626 626
627 627
628 LiveRange* RegisterAllocator::FixedDoubleLiveRangeFor(int index) { 628 LiveRange* RegisterAllocator::FixedDoubleLiveRangeFor(int index) {
629 DCHECK(index < DoubleRegister::NumAllocatableRegisters()); 629 DCHECK(index < DoubleRegister::NumAllocatableAliasedRegisters());
630 LiveRange* result = fixed_double_live_ranges_[index]; 630 LiveRange* result = fixed_double_live_ranges_[index];
631 if (result == NULL) { 631 if (result == NULL) {
632 result = new (zone()) LiveRange(FixedDoubleLiveRangeID(index), code_zone()); 632 result = new (zone()) LiveRange(FixedDoubleLiveRangeID(index), code_zone());
633 DCHECK(result->IsFixed()); 633 DCHECK(result->IsFixed());
634 result->kind_ = DOUBLE_REGISTERS; 634 result->kind_ = DOUBLE_REGISTERS;
635 SetLiveRangeAssignedRegister(result, index); 635 SetLiveRangeAssignedRegister(result, index);
636 fixed_double_live_ranges_[index] = result; 636 fixed_double_live_ranges_[index] = result;
637 } 637 }
638 return result; 638 return result;
639 } 639 }
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 for (int i = 0; i < Register::kMaxNumAllocatableRegisters; ++i) { 1009 for (int i = 0; i < Register::kMaxNumAllocatableRegisters; ++i) {
1010 if (!IsOutputRegisterOf(instr, i)) { 1010 if (!IsOutputRegisterOf(instr, i)) {
1011 LiveRange* range = FixedLiveRangeFor(i); 1011 LiveRange* range = FixedLiveRangeFor(i);
1012 range->AddUseInterval(curr_position, curr_position.InstructionEnd(), 1012 range->AddUseInterval(curr_position, curr_position.InstructionEnd(),
1013 zone()); 1013 zone());
1014 } 1014 }
1015 } 1015 }
1016 } 1016 }
1017 1017
1018 if (instr->ClobbersDoubleRegisters()) { 1018 if (instr->ClobbersDoubleRegisters()) {
1019 for (int i = 0; i < DoubleRegister::NumAllocatableRegisters(); ++i) { 1019 for (int i = 0; i < DoubleRegister::NumAllocatableAliasedRegisters();
1020 ++i) {
1020 if (!IsOutputDoubleRegisterOf(instr, i)) { 1021 if (!IsOutputDoubleRegisterOf(instr, i)) {
1021 LiveRange* range = FixedDoubleLiveRangeFor(i); 1022 LiveRange* range = FixedDoubleLiveRangeFor(i);
1022 range->AddUseInterval(curr_position, curr_position.InstructionEnd(), 1023 range->AddUseInterval(curr_position, curr_position.InstructionEnd(),
1023 zone()); 1024 zone());
1024 } 1025 }
1025 } 1026 }
1026 } 1027 }
1027 1028
1028 for (size_t i = 0; i < instr->InputCount(); i++) { 1029 for (size_t i = 0; i < instr->InputCount(); i++) {
1029 InstructionOperand* input = instr->InputAt(i); 1030 InstructionOperand* input = instr->InputAt(i);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 live_range->set_is_non_loop_phi(true); 1104 live_range->set_is_non_loop_phi(true);
1104 } 1105 }
1105 } 1106 }
1106 } 1107 }
1107 1108
1108 1109
1109 bool RegisterAllocator::Allocate() { 1110 bool RegisterAllocator::Allocate() {
1110 assigned_registers_ = new (code_zone()) 1111 assigned_registers_ = new (code_zone())
1111 BitVector(Register::NumAllocatableRegisters(), code_zone()); 1112 BitVector(Register::NumAllocatableRegisters(), code_zone());
1112 assigned_double_registers_ = new (code_zone()) 1113 assigned_double_registers_ = new (code_zone())
1113 BitVector(DoubleRegister::NumAllocatableRegisters(), code_zone()); 1114 BitVector(DoubleRegister::NumAllocatableAliasedRegisters(), code_zone());
1114 MeetRegisterConstraints(); 1115 MeetRegisterConstraints();
1115 if (!AllocationOk()) return false; 1116 if (!AllocationOk()) return false;
1116 ResolvePhis(); 1117 ResolvePhis();
1117 BuildLiveRanges(); 1118 BuildLiveRanges();
1118 AllocateGeneralRegisters(); 1119 AllocateGeneralRegisters();
1119 if (!AllocationOk()) return false; 1120 if (!AllocationOk()) return false;
1120 AllocateDoubleRegisters(); 1121 AllocateDoubleRegisters();
1121 if (!AllocationOk()) return false; 1122 if (!AllocationOk()) return false;
1122 PopulatePointerMaps(); 1123 PopulatePointerMaps();
1123 ConnectRanges(); 1124 ConnectRanges();
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 void RegisterAllocator::AllocateGeneralRegisters() { 1508 void RegisterAllocator::AllocateGeneralRegisters() {
1508 RegisterAllocatorPhase phase("L_Allocate general registers", this); 1509 RegisterAllocatorPhase phase("L_Allocate general registers", this);
1509 num_registers_ = Register::NumAllocatableRegisters(); 1510 num_registers_ = Register::NumAllocatableRegisters();
1510 mode_ = GENERAL_REGISTERS; 1511 mode_ = GENERAL_REGISTERS;
1511 AllocateRegisters(); 1512 AllocateRegisters();
1512 } 1513 }
1513 1514
1514 1515
1515 void RegisterAllocator::AllocateDoubleRegisters() { 1516 void RegisterAllocator::AllocateDoubleRegisters() {
1516 RegisterAllocatorPhase phase("L_Allocate double registers", this); 1517 RegisterAllocatorPhase phase("L_Allocate double registers", this);
1517 num_registers_ = DoubleRegister::NumAllocatableRegisters(); 1518 num_registers_ = DoubleRegister::NumAllocatableAliasedRegisters();
1518 mode_ = DOUBLE_REGISTERS; 1519 mode_ = DOUBLE_REGISTERS;
1519 AllocateRegisters(); 1520 AllocateRegisters();
1520 } 1521 }
1521 1522
1522 1523
1523 void RegisterAllocator::AllocateRegisters() { 1524 void RegisterAllocator::AllocateRegisters() {
1524 DCHECK(unhandled_live_ranges_.is_empty()); 1525 DCHECK(unhandled_live_ranges_.is_empty());
1525 1526
1526 for (int i = 0; i < live_ranges_.length(); ++i) { 1527 for (int i = 0; i < live_ranges_.length(); ++i) {
1527 if (live_ranges_[i] != NULL) { 1528 if (live_ranges_[i] != NULL) {
1528 if (live_ranges_[i]->Kind() == mode_) { 1529 if (live_ranges_[i]->Kind() == mode_) {
1529 AddToUnhandledUnsorted(live_ranges_[i]); 1530 AddToUnhandledUnsorted(live_ranges_[i]);
1530 } 1531 }
1531 } 1532 }
1532 } 1533 }
1533 SortUnhandled(); 1534 SortUnhandled();
1534 DCHECK(UnhandledIsSorted()); 1535 DCHECK(UnhandledIsSorted());
1535 1536
1536 DCHECK(reusable_slots_.is_empty()); 1537 DCHECK(reusable_slots_.is_empty());
1537 DCHECK(active_live_ranges_.is_empty()); 1538 DCHECK(active_live_ranges_.is_empty());
1538 DCHECK(inactive_live_ranges_.is_empty()); 1539 DCHECK(inactive_live_ranges_.is_empty());
1539 1540
1540 if (mode_ == DOUBLE_REGISTERS) { 1541 if (mode_ == DOUBLE_REGISTERS) {
1541 for (int i = 0; i < DoubleRegister::NumAllocatableRegisters(); ++i) { 1542 for (int i = 0; i < DoubleRegister::NumAllocatableAliasedRegisters(); ++i) {
1542 LiveRange* current = fixed_double_live_ranges_.at(i); 1543 LiveRange* current = fixed_double_live_ranges_.at(i);
1543 if (current != NULL) { 1544 if (current != NULL) {
1544 AddToInactive(current); 1545 AddToInactive(current);
1545 } 1546 }
1546 } 1547 }
1547 } else { 1548 } else {
1548 DCHECK(mode_ == GENERAL_REGISTERS); 1549 DCHECK(mode_ == GENERAL_REGISTERS);
1549 for (int i = 0; i < fixed_live_ranges_.length(); ++i) { 1550 for (int i = 0; i < fixed_live_ranges_.length(); ++i) {
1550 LiveRange* current = fixed_live_ranges_.at(i); 1551 LiveRange* current = fixed_live_ranges_.at(i);
1551 if (current != NULL) { 1552 if (current != NULL) {
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
2223 allocator_zone_start_allocation_size_; 2224 allocator_zone_start_allocation_size_;
2224 isolate()->GetTStatistics()->SaveTiming(name(), base::TimeDelta(), size); 2225 isolate()->GetTStatistics()->SaveTiming(name(), base::TimeDelta(), size);
2225 } 2226 }
2226 #ifdef DEBUG 2227 #ifdef DEBUG
2227 if (allocator_ != NULL) allocator_->Verify(); 2228 if (allocator_ != NULL) allocator_->Verify();
2228 #endif 2229 #endif
2229 } 2230 }
2230 } 2231 }
2231 } 2232 }
2232 } // namespace v8::internal::compiler 2233 } // namespace v8::internal::compiler
OLDNEW
« no previous file with comments | « src/compiler/raw-machine-assembler.h ('k') | src/compiler/representation-change.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698