private void shiftAllRegisters(int delta) {
    int insnSize = insns.size();

    for (int i = 0; i < insnSize; i++) {
      DalvInsn insn = insns.get(i);
      // Since there is no need to replace CodeAddress since it does not use registers, skips it to
      // avoid to update all TargetInsn that contain a reference to CodeAddress
      if (!(insn instanceof CodeAddress)) {
        insns.set(i, insn.withRegisterOffset(delta));
      }
    }
  }
Helper for {@link #assignAddressesAndFixBranches}, which checks the branch target size
requirement of each branch instruction to make sure it fits. For instructions that don't fit,
this rewrites them to use a {@code goto} of some sort. In the case of a conditional branch that
doesn't fit, the sense of the test is reversed in order to branch around a {@code goto} to the
original target.

@return whether any branches had to be fixed
android/android_framework/dex-maker/src/main/java/com/android/dx/dex/code/OutputFinisher.java