Add conditional branches, and build dominator tree.

Change-Id: I4b151a07b72692961235a1419b54b6b45cf54e63
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 @@
  public:
   explicit HGraphBuilder(ArenaAllocator* arena)
       : arena_(arena),
+        branch_targets_(arena, 0),
         entry_block_(nullptr),
         exit_block_(nullptr),
         current_block_(nullptr),
@@ -41,9 +43,21 @@
   // 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_;