summaryrefslogtreecommitdiffstats
path: root/compiler/optimizing/builder.h
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2014-02-25 14:22:56 +0000
committerNicolas Geoffray <ngeoffray@google.com>2014-02-26 13:24:04 +0000
commitbe9a92aa804c0d210f80966b74ef8ed3987f335a (patch)
tree10d58622f626f03156e0dec1f1fc00616554b336 /compiler/optimizing/builder.h
parent3188d117d6f1ba5f3a30d0ff231d816ebb59a7f7 (diff)
downloadart-be9a92aa804c0d210f80966b74ef8ed3987f335a.zip
art-be9a92aa804c0d210f80966b74ef8ed3987f335a.tar.gz
art-be9a92aa804c0d210f80966b74ef8ed3987f335a.tar.bz2
Add conditional branches, and build dominator tree.
Change-Id: I4b151a07b72692961235a1419b54b6b45cf54e63
Diffstat (limited to 'compiler/optimizing/builder.h')
-rw-r--r--compiler/optimizing/builder.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/compiler/optimizing/builder.h b/compiler/optimizing/builder.h
index 3e94fba..fbeb7a7 100644
--- a/compiler/optimizing/builder.h
+++ b/compiler/optimizing/builder.h
@@ -18,6 +18,7 @@
#define ART_COMPILER_OPTIMIZING_BUILDER_H_
#include "utils/allocation.h"
+#include "utils/growable_array.h"
namespace art {
@@ -30,6 +31,7 @@ class HGraphBuilder : public ValueObject {
public:
explicit HGraphBuilder(ArenaAllocator* arena)
: arena_(arena),
+ branch_targets_(arena, 0),
entry_block_(nullptr),
exit_block_(nullptr),
current_block_(nullptr),
@@ -41,9 +43,21 @@ class HGraphBuilder : public ValueObject {
// Analyzes the dex instruction and adds HInstruction to the graph
// to execute that instruction. Returns whether the instruction can
// be handled.
- bool AnalyzeDexInstruction(const Instruction& instruction);
+ bool AnalyzeDexInstruction(const Instruction& instruction, int32_t dex_offset);
+
+ // Finds all instructions that start a new block, and populates branch_targets_ with
+ // the newly created blocks.
+ void ComputeBranchTargets(const uint16_t* start, const uint16_t* end);
+ void MaybeUpdateCurrentBlock(size_t index);
+ HBasicBlock* FindBlockStartingAt(int32_t index) const;
ArenaAllocator* const arena_;
+
+ // A list of the size of the dex code holding block information for
+ // the method. If an entry contains a block, then the dex instruction
+ // starting at that entry is the first instruction of a new block.
+ GrowableArray<HBasicBlock*> branch_targets_;
+
HBasicBlock* entry_block_;
HBasicBlock* exit_block_;
HBasicBlock* current_block_;