private void addInstruction(Insn insn, Label branch) {
    if (currentLabel == null || !currentLabel.marked) {
      throw new IllegalStateException("no current label");
    }
    currentLabel.instructions.add(insn);

    switch (insn.getOpcode().getBranchingness()) {
      case BRANCH_NONE:
        if (branch != null) {
          throw new IllegalArgumentException("unexpected branch: " + branch);
        }
        return;

      case BRANCH_RETURN:
        if (branch != null) {
          throw new IllegalArgumentException("unexpected branch: " + branch);
        }
        currentLabel = null;
        break;

      case BRANCH_GOTO:
        if (branch == null) {
          throw new IllegalArgumentException("branch == null");
        }
        currentLabel.primarySuccessor = branch;
        currentLabel = null;
        break;

      case Rop.BRANCH_IF:
        if (branch == null) {
          throw new IllegalArgumentException("branch == null");
        }
        splitCurrentLabel(branch, Collections.<Label>emptyList());
        break;

      case Rop.BRANCH_THROW:
        if (branch != null) {
          throw new IllegalArgumentException("unexpected branch: " + branch);
        }
        splitCurrentLabel(null, new ArrayList<Label>(catchLabels));
        break;

      default:
        throw new IllegalArgumentException();
    }
  }
@param branch the branches to follow; interpretation depends on the instruction's
    branchingness.
android/android_framework/dex-maker/src/main/java/com/android/dx/Code.java