question: public void forEachBlockDepthFirst ( boolean reverse , SsaBasicBlock . Visitor v ) { BitSet visited = new BitSet ( blocks . size ( ) ) ; Stack < SsaBasicBlock > stack = new Stack < SsaBasicBlock > ( ) ; SsaBasicBlock rootBlock = reverse ? getExitBlock ( ) : getEntryBlock ( ) ; if ( rootBlock == null ) { return ; } stack . add ( null ) ; stack . add ( rootBlock ) ; while ( stack . size ( ) > 0 ) { SsaBasicBlock cur = stack . pop ( ) ; SsaBasicBlock parent = stack . pop ( ) ; if ( ! visited . get ( cur . getIndex ( ) ) ) { BitSet children = reverse ? cur . getPredecessors ( ) : cur . getSuccessors ( ) ; for ( int i = children . nextSetBit ( 0 ) ; i >= 0 ; i = children . nextSetBit ( i + 1 ) ) { stack . add ( cur ) ; stack . add ( blocks . get ( i ) ) ; } visited . set ( cur . getIndex ( ) ) ; v . visitBlock ( cur , parent ) ; } } }
target:  Walks the basic block tree in depth-first order, calling the visitor method once for every block. This depth-first walk may be run forward from the method entry point or backwards from the method exit points.