private static void addConstants(HashSet<Constant> result, DalvInsn insn) {
    if (insn instanceof CstInsn) {
      Constant cst = ((CstInsn) insn).getConstant();
      result.add(cst);
    } else if (insn instanceof MultiCstInsn) {
      MultiCstInsn m = (MultiCstInsn) insn;
      for (int i = 0; i < m.getNumberOfConstants(); i++) {
        result.add(m.getConstant(i));
      }
    } else if (insn instanceof LocalSnapshot) {
      RegisterSpecSet specs = ((LocalSnapshot) insn).getLocals();
      int size = specs.size();
      for (int i = 0; i < size; i++) {
        addConstants(result, specs.get(i));
      }
    } else if (insn instanceof LocalStart) {
      RegisterSpec spec = ((LocalStart) insn).getLocal();
      addConstants(result, spec);
    }
  }
Helper for {@link #getAllConstants} which adds all the info for a single instruction.

@param result {@code non-null;} result set to add to
@param insn {@code non-null;} instruction to scrutinize
android/android_framework/dex-maker/src/main/java/com/android/dx/dex/code/OutputFinisher.java