diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2014-07-04 09:41:32 +0100 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2014-07-14 10:06:11 +0100 |
commit | e50383288a75244255d3ecedcc79ffe9caf774cb (patch) | |
tree | 8858489463a57c7b50f7db4d972abec21302b7a7 /compiler/optimizing/code_generator.cc | |
parent | cf90ba7ebe00346651f3b7ce1e5b1f785f7caabd (diff) | |
download | android_art-e50383288a75244255d3ecedcc79ffe9caf774cb.tar.gz android_art-e50383288a75244255d3ecedcc79ffe9caf774cb.tar.bz2 android_art-e50383288a75244255d3ecedcc79ffe9caf774cb.zip |
Support fields in optimizing compiler.
- Required support for temporaries, to be only used by baseline compiler.
- Also fixed a few invalid assumptions around locations and instructions
that don't need materialization. These instructions should not have an Out.
Change-Id: Idc4a30dd95dd18015137300d36bec55fc024cf62
Diffstat (limited to 'compiler/optimizing/code_generator.cc')
-rw-r--r-- | compiler/optimizing/code_generator.cc | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/compiler/optimizing/code_generator.cc b/compiler/optimizing/code_generator.cc index b8332ad2a3..b0e6a75b3d 100644 --- a/compiler/optimizing/code_generator.cc +++ b/compiler/optimizing/code_generator.cc @@ -39,6 +39,7 @@ void CodeGenerator::CompileBaseline(CodeAllocator* allocator) { DCHECK_EQ(frame_size_, kUninitializedFrameSize); ComputeFrameSize(GetGraph()->GetMaximumNumberOfOutVRegs() + GetGraph()->GetNumberOfVRegs() + + GetGraph()->GetNumberOfTemporaries() + 1 /* filler */); GenerateFrameEntry(); @@ -54,6 +55,7 @@ void CodeGenerator::CompileBaseline(CodeAllocator* allocator) { current->Accept(instruction_visitor); } } + GenerateSlowPaths(); size_t code_size = GetAssembler()->CodeSize(); uint8_t* buffer = allocator->Allocate(code_size); @@ -79,6 +81,7 @@ void CodeGenerator::CompileOptimized(CodeAllocator* allocator) { current->Accept(instruction_visitor); } } + GenerateSlowPaths(); size_t code_size = GetAssembler()->CodeSize(); uint8_t* buffer = allocator->Allocate(code_size); @@ -86,6 +89,12 @@ void CodeGenerator::CompileOptimized(CodeAllocator* allocator) { GetAssembler()->FinalizeInstructions(code); } +void CodeGenerator::GenerateSlowPaths() { + for (size_t i = 0, e = slow_paths_.Size(); i < e; ++i) { + slow_paths_.Get(i)->EmitNativeCode(this); + } +} + size_t CodeGenerator::AllocateFreeRegisterInternal( bool* blocked_registers, size_t number_of_registers) const { for (size_t regno = 0; regno < number_of_registers; regno++) { @@ -94,7 +103,6 @@ size_t CodeGenerator::AllocateFreeRegisterInternal( return regno; } } - LOG(FATAL) << "Unreachable"; return -1; } @@ -162,13 +170,6 @@ void CodeGenerator::AllocateRegistersLocally(HInstruction* instruction) const { locations->SetTempAt(i, loc); } } - - // Make all registers available for the return value. - for (size_t i = 0, e = GetNumberOfRegisters(); i < e; ++i) { - blocked_registers_[i] = false; - } - SetupBlockedRegisters(blocked_registers_); - Location result_location = locations->Out(); if (result_location.IsUnallocated()) { switch (result_location.GetPolicy()) { @@ -187,6 +188,12 @@ void CodeGenerator::AllocateRegistersLocally(HInstruction* instruction) const { void CodeGenerator::InitLocations(HInstruction* instruction) { if (instruction->GetLocations() == nullptr) { + if (instruction->IsTemporary()) { + HInstruction* previous = instruction->GetPrevious(); + Location temp_location = GetTemporaryLocation(instruction->AsTemporary()); + Move(previous, temp_location, instruction); + previous->GetLocations()->SetOut(temp_location); + } return; } AllocateRegistersLocally(instruction); |