private static void encodeRegisterList(DecodedInstruction insn, CodeOutput out) {
    out.write(
        codeUnit(insn.getOpcode(), makeByte(insn.getE(), insn.getRegisterCount())),
        insn.getIndexUnit(),
        codeUnit(insn.getA(), insn.getB(), insn.getC(), insn.getD()));
  }
Helper method that encodes any of the register-list formats.
android/android_framework/dex-maker/src/main/java/com/android/dx/io/instructions/InstructionCodec.java