private static void addJumpIfNextNotDestination ( CFG cfg , BasicBlock next , Instruction lastInstr , BasicBlock current ) { Iterator < BasicBlock > outs = cfg . getOutgoingDestinations ( current ) . iterator ( ) ; BasicBlock target = outs . hasNext ( ) ? outs . next ( ) : null ; if ( target != null && ! outs . hasNext ( ) ) { if ( ( target != next ) && ( ( lastInstr == null ) || ! lastInstr . transfersControl ( ) ) ) { current . addInstr ( new Jump ( target . getLabel ( ) ) ) ; } } }
If there is no jump at add of block and the next block is not destination insert a valid jump