From 9af895db5dd238f1d637fa6176caa2d1ca8682ae Mon Sep 17 00:00:00 2001 From: Clemens Backes Date: Fri, 7 Jan 2022 16:11:32 +0100 Subject: [PATCH] [compiler] Remove more unneeded accessors Inlining the field accesses make the code simpler by avoiding the abstraction of the accessor, and makes stepping through the code for debugging easier. R=thibaudm@chromium.org Bug: v8:12330 Change-Id: I51bd0e88baa5ffba5bd4bfcca36e95caab7468c3 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3372913 Reviewed-by: Thibaud Michaud Commit-Queue: Clemens Backes Cr-Commit-Position: refs/heads/main@{#78521} --- .../backend/mid-tier-register-allocator.cc | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/compiler/backend/mid-tier-register-allocator.cc b/src/compiler/backend/mid-tier-register-allocator.cc index 65c4f9babf..5bd97c4c7c 100644 --- a/src/compiler/backend/mid-tier-register-allocator.cc +++ b/src/compiler/backend/mid-tier-register-allocator.cc @@ -1543,9 +1543,6 @@ class SinglePassRegisterAllocator final { return data_->VirtualRegisterDataFor(virtual_register); } - int num_allocatable_registers() const { return num_allocatable_registers_; } - const InstructionBlock* current_block() const { return current_block_; } - // Virtual register to register mapping. ZoneVector virtual_register_to_reg_; @@ -1839,7 +1836,7 @@ void SinglePassRegisterAllocator::SpillRegisterAtMerge(RegisterState* reg_state, VirtualRegisterData& vreg_data = data_->VirtualRegisterDataFor(virtual_register); AllocatedOperand allocated = AllocatedOperandForReg(reg, vreg_data.rep()); - reg_state->Spill(reg, allocated, current_block(), data_); + reg_state->Spill(reg, allocated, current_block_, data_); } } @@ -1948,7 +1945,7 @@ void SinglePassRegisterAllocator::EmitGapMoveFromOutput(InstructionOperand from, int instr_index) { DCHECK(from.IsAllocated()); DCHECK(to.IsAllocated()); - const InstructionBlock* block = current_block(); + const InstructionBlock* block = current_block_; DCHECK_EQ(data_->GetBlock(instr_index), block); if (instr_index == block->last_instruction_index()) { // Add gap move to the first instruction of every successor block. @@ -2081,7 +2078,7 @@ RegisterIndex SinglePassRegisterAllocator::ChooseFreeRegister( const RegisterBitVector& allocated_regs, MachineRepresentation rep) { RegisterIndex chosen_reg = RegisterIndex::Invalid(); if (kSimpleFPAliasing || kind() == RegisterKind::kGeneral) { - chosen_reg = allocated_regs.GetFirstCleared(num_allocatable_registers()); + chosen_reg = allocated_regs.GetFirstCleared(num_allocatable_registers_); } else { // If we don't have simple fp aliasing, we need to check each register // individually to get one with the required representation. @@ -2160,7 +2157,7 @@ void SinglePassRegisterAllocator::SpillRegister(RegisterIndex reg) { int virtual_register = VirtualRegisterForRegister(reg); MachineRepresentation rep = VirtualRegisterDataFor(virtual_register).rep(); AllocatedOperand allocated = AllocatedOperandForReg(reg, rep); - register_state_->Spill(reg, allocated, current_block(), data_); + register_state_->Spill(reg, allocated, current_block_, data_); FreeRegister(reg, virtual_register, rep); } @@ -2377,7 +2374,7 @@ void SinglePassRegisterAllocator::AllocateConstantOutput( // necessary gap moves from the constant operand to the register. SpillRegisterForVirtualRegister(vreg_data.vreg()); if (vreg_data.NeedsSpillAtOutput()) { - vreg_data.EmitGapMoveFromOutputToSpillSlot(*operand, current_block(), + vreg_data.EmitGapMoveFromOutputToSpillSlot(*operand, current_block_, instr_index, data_); } } @@ -2430,8 +2427,7 @@ RegisterIndex SinglePassRegisterAllocator::AllocateOutput( } if (vreg_data.NeedsSpillAtOutput()) { vreg_data.EmitGapMoveFromOutputToSpillSlot( - *AllocatedOperand::cast(operand), current_block(), instr_index, - data_); + *AllocatedOperand::cast(operand), current_block_, instr_index, data_); } else if (vreg_data.NeedsSpillAtDeferredBlocks()) { vreg_data.EmitDeferredSpillOutputs(data_); }