From 5b4b898ed8725242ee6b7229b94467c3ea3054c8 Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Thu, 18 Dec 2014 17:45:56 +0000 Subject: Revert "Don't block quick callee saved registers for optimizing." X64 has one libcore test failing, and codegen_test on arm is failing. This reverts commit 6004796d6c630696127df2494dcd4f30d1367a34. Change-Id: I20e00431fa18e11ce4c0cb6fffa91977fa8e9b4f --- compiler/optimizing/code_generator.cc | 66 +++++++++++++++++------------------ 1 file changed, 32 insertions(+), 34 deletions(-) (limited to 'compiler/optimizing/code_generator.cc') diff --git a/compiler/optimizing/code_generator.cc b/compiler/optimizing/code_generator.cc index 5334031dcb..461409ddca 100644 --- a/compiler/optimizing/code_generator.cc +++ b/compiler/optimizing/code_generator.cc @@ -177,31 +177,6 @@ int32_t CodeGenerator::GetStackSlot(HLocal* local) const { } } -void CodeGenerator::MaybeBlockPhysicalRegisters(Location loc, bool is_output) const { - // The DCHECKS below check that a register is not specified twice in - // the summary. - // Note that fixed output registers are allowed to overlap with fixed input and - // temp registers: the writer of the location summary has to make sure they - // don't conflict with each other. - if (loc.IsRegister()) { - DCHECK(is_output || !blocked_core_registers_[loc.reg()]); - blocked_core_registers_[loc.reg()] = true; - } else if (loc.IsFpuRegister()) { - DCHECK(is_output || !blocked_fpu_registers_[loc.reg()]); - blocked_fpu_registers_[loc.reg()] = true; - } else if (loc.IsFpuRegisterPair()) { - DCHECK(is_output || !blocked_fpu_registers_[loc.AsFpuRegisterPairLow()]); - blocked_fpu_registers_[loc.AsFpuRegisterPairLow()] = true; - DCHECK(is_output || !blocked_fpu_registers_[loc.AsFpuRegisterPairHigh()]); - blocked_fpu_registers_[loc.AsFpuRegisterPairHigh()] = true; - } else if (loc.IsRegisterPair()) { - DCHECK(is_output || !blocked_core_registers_[loc.AsRegisterPairLow()]); - blocked_core_registers_[loc.AsRegisterPairLow()] = true; - DCHECK(is_output || !blocked_core_registers_[loc.AsRegisterPairHigh()]); - blocked_core_registers_[loc.AsRegisterPairHigh()] = true; - } -} - void CodeGenerator::AllocateRegistersLocally(HInstruction* instruction) const { LocationSummary* locations = instruction->GetLocations(); if (locations == nullptr) return; @@ -221,18 +196,43 @@ void CodeGenerator::AllocateRegistersLocally(HInstruction* instruction) const { // Mark all fixed input, temp and output registers as used. for (size_t i = 0, e = locations->GetInputCount(); i < e; ++i) { Location loc = locations->InAt(i); - MaybeBlockPhysicalRegisters(loc, false); + // The DCHECKS below check that a register is not specified twice in + // the summary. + if (loc.IsRegister()) { + DCHECK(!blocked_core_registers_[loc.reg()]); + blocked_core_registers_[loc.reg()] = true; + } else if (loc.IsFpuRegister()) { + DCHECK(!blocked_fpu_registers_[loc.reg()]); + blocked_fpu_registers_[loc.reg()] = true; + } else if (loc.IsFpuRegisterPair()) { + DCHECK(!blocked_fpu_registers_[loc.AsFpuRegisterPairLow()]); + blocked_fpu_registers_[loc.AsFpuRegisterPairLow()] = true; + DCHECK(!blocked_fpu_registers_[loc.AsFpuRegisterPairHigh()]); + blocked_fpu_registers_[loc.AsFpuRegisterPairHigh()] = true; + } else if (loc.IsRegisterPair()) { + DCHECK(!blocked_core_registers_[loc.AsRegisterPairLow()]); + blocked_core_registers_[loc.AsRegisterPairLow()] = true; + DCHECK(!blocked_core_registers_[loc.AsRegisterPairHigh()]); + blocked_core_registers_[loc.AsRegisterPairHigh()] = true; + } } for (size_t i = 0, e = locations->GetTempCount(); i < e; ++i) { Location loc = locations->GetTemp(i); - MaybeBlockPhysicalRegisters(loc, false); + // The DCHECKS below check that a register is not specified twice in + // the summary. + if (loc.IsRegister()) { + DCHECK(!blocked_core_registers_[loc.reg()]); + blocked_core_registers_[loc.reg()] = true; + } else if (loc.IsFpuRegister()) { + DCHECK(!blocked_fpu_registers_[loc.reg()]); + blocked_fpu_registers_[loc.reg()] = true; + } else { + DCHECK(loc.GetPolicy() == Location::kRequiresRegister + || loc.GetPolicy() == Location::kRequiresFpuRegister); + } } - // If the output is a fixed register, mark it as used. - Location result_location = locations->Out(); - MaybeBlockPhysicalRegisters(result_location, true); - SetupBlockedRegisters(); // Allocate all unallocated input locations. @@ -276,11 +276,9 @@ void CodeGenerator::AllocateRegistersLocally(HInstruction* instruction) const { << loc.GetPolicy(); } locations->SetTempAt(i, loc); - } else { - DCHECK(loc.IsFpuRegister() || loc.IsRegister()); } } - + Location result_location = locations->Out(); if (result_location.IsUnallocated()) { switch (result_location.GetPolicy()) { case Location::kAny: -- cgit v1.2.3-59-g8ed1b