From f8c762b8cbd4a223c697d7e7bdb976fb39224cb8 Mon Sep 17 00:00:00 2001 From: Jean Christophe Beyler Date: Fri, 2 May 2014 12:54:37 -0700 Subject: ART: ChildBlockIterator Implementation - Added the API to be able to walk through a BasicBlock's children directly. - When calling Reset(GrowableArray*), there is an assignment to the g_list_ member. This is not possible with the g_list_ being const. Change-Id: I25d06484fd93848d80ccf96a1324058370b2ee46 Signed-Off-By: Jean Christophe Beyler Signed-off-by: Razvan A Lupusoru Signed-off-by: Yixin Shou Signed-off-by: Chao-ying Fu Signed-off-by: Udayan Banerji --- compiler/dex/mir_graph.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'compiler/dex/mir_graph.h') diff --git a/compiler/dex/mir_graph.h b/compiler/dex/mir_graph.h index c728d84942..85a2d04306 100644 --- a/compiler/dex/mir_graph.h +++ b/compiler/dex/mir_graph.h @@ -341,6 +341,29 @@ struct SuccessorBlockInfo { int key; }; +/** + * @class ChildBlockIterator + * @brief Enable an easy iteration of the children. + */ +class ChildBlockIterator { + public: + /** + * @brief Constructs a child iterator. + * @param bb The basic whose children we need to iterate through. + * @param mir_graph The MIRGraph used to get the basic block during iteration. + */ + ChildBlockIterator(BasicBlock* bb, MIRGraph* mir_graph); + BasicBlock* Next(); + + private: + BasicBlock* basic_block_; + MIRGraph* mir_graph_; + bool visited_fallthrough_; + bool visited_taken_; + bool have_successors_; + GrowableArray::Iterator successor_iter_; +}; + /* * Whereas a SSA name describes a definition of a Dalvik vreg, the RegLocation describes * the type of an SSA name (and, can also be used by code generators to record where the -- cgit v1.2.3