diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2014-05-22 12:50:17 +0100 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2014-05-26 11:31:38 +0100 |
commit | a7062e05e6048c7f817d784a5b94e3122e25b1ec (patch) | |
tree | a5d6b64ae6d5352f761fc2547bda863281adbe40 /compiler/optimizing/code_generator.h | |
parent | 8b5b1e5593ffa77c393e4172b71a3d5a821d2ed8 (diff) | |
download | art-a7062e05e6048c7f817d784a5b94e3122e25b1ec.zip art-a7062e05e6048c7f817d784a5b94e3122e25b1ec.tar.gz art-a7062e05e6048c7f817d784a5b94e3122e25b1ec.tar.bz2 |
Add a linear scan register allocator to the optimizing compiler.
This is a "by-the-book" implementation. It currently only deals
with allocating registers, with no hint optimizations.
The changes remaining to make it functional are:
- Allocate spill slots.
- Resolution and placements of Move instructions.
- Connect it to the code generator.
Change-Id: Ie0b2f6ba1b98da85425be721ce4afecd6b4012a4
Diffstat (limited to 'compiler/optimizing/code_generator.h')
-rw-r--r-- | compiler/optimizing/code_generator.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/compiler/optimizing/code_generator.h b/compiler/optimizing/code_generator.h index e18902f..e197ccd 100644 --- a/compiler/optimizing/code_generator.h +++ b/compiler/optimizing/code_generator.h @@ -74,6 +74,13 @@ class CodeGenerator : public ArenaObject { void SetFrameSize(uint32_t size) { frame_size_ = size; } uint32_t GetCoreSpillMask() const { return core_spill_mask_; } + virtual size_t GetNumberOfCoreRegisters() const = 0; + virtual size_t GetNumberOfFloatingPointRegisters() const = 0; + virtual size_t GetNumberOfRegisters() const = 0; + virtual void SetupBlockedRegisters(bool* blocked_registers) const = 0; + virtual void DumpCoreRegister(std::ostream& stream, int reg) const = 0; + virtual void DumpFloatingPointRegister(std::ostream& stream, int reg) const = 0; + void RecordPcInfo(uint32_t dex_pc) { struct PcInfo pc_info; pc_info.dex_pc = dex_pc; @@ -92,8 +99,7 @@ class CodeGenerator : public ArenaObject { graph_(graph), block_labels_(graph->GetArena(), 0), pc_infos_(graph->GetArena(), 32), - blocked_registers_(static_cast<bool*>( - graph->GetArena()->Alloc(number_of_registers * sizeof(bool), kArenaAllocData))) { + blocked_registers_(graph->GetArena()->AllocArray<bool>(number_of_registers)) { block_labels_.SetSize(graph->GetBlocks().Size()); } ~CodeGenerator() { } @@ -109,9 +115,6 @@ class CodeGenerator : public ArenaObject { // the first available register. size_t AllocateFreeRegisterInternal(bool* blocked_registers, size_t number_of_registers) const; - virtual void SetupBlockedRegisters(bool* blocked_registers) const = 0; - virtual size_t GetNumberOfRegisters() const = 0; - virtual Location GetStackLocation(HLoadLocal* load) const = 0; // Frame size required for this method. |