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

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

Issue 1075863002: [turbofan] Make AllocatedOperand an InstructionOperand::Kind. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « src/compiler/instruction.cc ('k') | test/cctest/compiler/test-gap-resolver.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 #include "src/compiler/linkage.h" 5 #include "src/compiler/linkage.h"
6 #include "src/compiler/register-allocator.h" 6 #include "src/compiler/register-allocator.h"
7 #include "src/string-stream.h" 7 #include "src/string-stream.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 return -index - 1 - config()->num_general_registers(); 700 return -index - 1 - config()->num_general_registers();
701 } 701 }
702 702
703 703
704 InstructionOperand* RegisterAllocator::AllocateFixed( 704 InstructionOperand* RegisterAllocator::AllocateFixed(
705 UnallocatedOperand* operand, int pos, bool is_tagged) { 705 UnallocatedOperand* operand, int pos, bool is_tagged) {
706 TRACE("Allocating fixed reg for op %d\n", operand->virtual_register()); 706 TRACE("Allocating fixed reg for op %d\n", operand->virtual_register());
707 DCHECK(operand->HasFixedPolicy()); 707 DCHECK(operand->HasFixedPolicy());
708 InstructionOperand allocated; 708 InstructionOperand allocated;
709 if (operand->HasFixedSlotPolicy()) { 709 if (operand->HasFixedSlotPolicy()) {
710 allocated = AllocatedOperand(InstructionOperand::STACK_SLOT, 710 allocated = AllocatedOperand(AllocatedOperand::STACK_SLOT,
711 operand->fixed_slot_index()); 711 operand->fixed_slot_index());
712 } else if (operand->HasFixedRegisterPolicy()) { 712 } else if (operand->HasFixedRegisterPolicy()) {
713 allocated = AllocatedOperand(InstructionOperand::REGISTER, 713 allocated = AllocatedOperand(AllocatedOperand::REGISTER,
714 operand->fixed_register_index()); 714 operand->fixed_register_index());
715 } else if (operand->HasFixedDoubleRegisterPolicy()) { 715 } else if (operand->HasFixedDoubleRegisterPolicy()) {
716 allocated = AllocatedOperand(InstructionOperand::DOUBLE_REGISTER, 716 allocated = AllocatedOperand(AllocatedOperand::DOUBLE_REGISTER,
717 operand->fixed_register_index()); 717 operand->fixed_register_index());
718 } else { 718 } else {
719 UNREACHABLE(); 719 UNREACHABLE();
720 } 720 }
721 InstructionOperand::ReplaceWith(operand, &allocated); 721 InstructionOperand::ReplaceWith(operand, &allocated);
722 if (is_tagged) { 722 if (is_tagged) {
723 TRACE("Fixed reg is tagged at %d\n", pos); 723 TRACE("Fixed reg is tagged at %d\n", pos);
724 auto instr = InstructionAt(pos); 724 auto instr = InstructionAt(pos);
725 if (instr->HasPointerMap()) { 725 if (instr->HasPointerMap()) {
726 instr->pointer_map()->RecordPointer(operand, code_zone()); 726 instr->pointer_map()->RecordPointer(operand, code_zone());
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 } 969 }
970 } 970 }
971 971
972 // Allocate slots for the merged spill ranges. 972 // Allocate slots for the merged spill ranges.
973 for (auto range : spill_ranges()) { 973 for (auto range : spill_ranges()) {
974 if (range->IsEmpty()) continue; 974 if (range->IsEmpty()) continue;
975 // Allocate a new operand referring to the spill slot. 975 // Allocate a new operand referring to the spill slot.
976 auto kind = range->Kind(); 976 auto kind = range->Kind();
977 int index = frame()->AllocateSpillSlot(kind == DOUBLE_REGISTERS); 977 int index = frame()->AllocateSpillSlot(kind == DOUBLE_REGISTERS);
978 auto op_kind = kind == DOUBLE_REGISTERS 978 auto op_kind = kind == DOUBLE_REGISTERS
979 ? InstructionOperand::DOUBLE_STACK_SLOT 979 ? AllocatedOperand::DOUBLE_STACK_SLOT
980 : InstructionOperand::STACK_SLOT; 980 : AllocatedOperand::STACK_SLOT;
981 auto op = AllocatedOperand::New(code_zone(), op_kind, index); 981 auto op = AllocatedOperand::New(code_zone(), op_kind, index);
982 range->SetOperand(op); 982 range->SetOperand(op);
983 } 983 }
984 } 984 }
985 985
986 986
987 void RegisterAllocator::CommitAssignment() { 987 void RegisterAllocator::CommitAssignment() {
988 for (auto range : live_ranges()) { 988 for (auto range : live_ranges()) {
989 if (range == nullptr || range->IsEmpty()) continue; 989 if (range == nullptr || range->IsEmpty()) continue;
990 auto assigned = range->GetAssignedOperand(operand_cache()); 990 auto assigned = range->GetAssignedOperand(operand_cache());
(...skipping 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after
2533 } else { 2533 } else {
2534 DCHECK(range->Kind() == GENERAL_REGISTERS); 2534 DCHECK(range->Kind() == GENERAL_REGISTERS);
2535 assigned_registers_->Add(reg); 2535 assigned_registers_->Add(reg);
2536 } 2536 }
2537 range->set_assigned_register(reg, operand_cache()); 2537 range->set_assigned_register(reg, operand_cache());
2538 } 2538 }
2539 2539
2540 } // namespace compiler 2540 } // namespace compiler
2541 } // namespace internal 2541 } // namespace internal
2542 } // namespace v8 2542 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/instruction.cc ('k') | test/cctest/compiler/test-gap-resolver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698