diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2014-03-04 14:46:47 +0000 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2014-03-10 11:41:22 +0000 |
commit | 3ff386aafefd5282bb76c8a50506a70a4321e698 (patch) | |
tree | 5f6e990553daae150a168f581bac79e659f7f712 /compiler/optimizing/builder.h | |
parent | 0307b5c91c287e08cd414ecc5de32befceb7e371 (diff) | |
download | art-3ff386aafefd5282bb76c8a50506a70a4321e698.zip art-3ff386aafefd5282bb76c8a50506a70a4321e698.tar.gz art-3ff386aafefd5282bb76c8a50506a70a4321e698.tar.bz2 |
Add register support to the optimizing compiler.
Also make if take an input and build the use list for instructions.
Change-Id: I1938cee7dce5bd4c66b259fa2b431d2c79b3cf82
Diffstat (limited to 'compiler/optimizing/builder.h')
-rw-r--r-- | compiler/optimizing/builder.h | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/compiler/optimizing/builder.h b/compiler/optimizing/builder.h index fbeb7a7..399dd63 100644 --- a/compiler/optimizing/builder.h +++ b/compiler/optimizing/builder.h @@ -17,6 +17,7 @@ #ifndef ART_COMPILER_OPTIMIZING_BUILDER_H_ #define ART_COMPILER_OPTIMIZING_BUILDER_H_ +#include "dex_file.h" #include "utils/allocation.h" #include "utils/growable_array.h" @@ -26,18 +27,23 @@ class ArenaAllocator; class Instruction; class HBasicBlock; class HGraph; +class HIntConstant; +class HInstruction; +class HLocal; class HGraphBuilder : public ValueObject { public: explicit HGraphBuilder(ArenaAllocator* arena) : arena_(arena), branch_targets_(arena, 0), + locals_(arena, 0), entry_block_(nullptr), exit_block_(nullptr), current_block_(nullptr), - graph_(nullptr) { } + graph_(nullptr), + constant0_(nullptr) { } - HGraph* BuildGraph(const uint16_t* start, const uint16_t* end); + HGraph* BuildGraph(const DexFile::CodeItem& code); private: // Analyzes the dex instruction and adds HInstruction to the graph @@ -51,6 +57,13 @@ class HGraphBuilder : public ValueObject { void MaybeUpdateCurrentBlock(size_t index); HBasicBlock* FindBlockStartingAt(int32_t index) const; + HIntConstant* GetConstant0(); + HIntConstant* GetConstant(int constant); + void InitializeLocals(int count); + HLocal* GetLocalAt(int register_index) const; + void UpdateLocal(int register_index, HInstruction* instruction) const; + HInstruction* LoadLocal(int register_index) const; + ArenaAllocator* const arena_; // A list of the size of the dex code holding block information for @@ -58,11 +71,15 @@ class HGraphBuilder : public ValueObject { // starting at that entry is the first instruction of a new block. GrowableArray<HBasicBlock*> branch_targets_; + GrowableArray<HLocal*> locals_; + HBasicBlock* entry_block_; HBasicBlock* exit_block_; HBasicBlock* current_block_; HGraph* graph_; + HIntConstant* constant0_; + DISALLOW_COPY_AND_ASSIGN(HGraphBuilder); }; |