To support for prefix padding to align branches within 32-Byte boundary, we need to know the number of the existing prefixes of instructions , since too many prefixes before one instruction can be a performance issue on some microarchitecture.
The code of emitting prefixes is extracted out from the function `encodeInstruction` as `emitPrefix`, then we can emit the prefixes into a dummy stream, and count the prefixes of each instruction.