public BitSet computeReachability() {
    final int size = blocks.size();
    BitSet reachableUnvisited = new BitSet(size);
    BitSet reachableVisited = new BitSet(size);

    reachableUnvisited.set(getEntryBlock().getIndex());

    int index;
    while ((index = reachableUnvisited.nextSetBit(0)) != -1) {
      reachableVisited.set(index);
      reachableUnvisited.or(blocks.get(index).getSuccessors());
      reachableUnvisited.andNot(reachableVisited);
    }

    return reachableVisited;
  }
Computes reachability for all blocks in the method.

@return a BitSet of reachable blocks.
android/android_framework/dex-maker/src/main/java/com/android/dx/ssa/SsaMethod.java