Many processor instruction sets are variable-length, including the
popular Intel x86 and the AMD x86-64 architectures, as well as ARM's
Thumb-2 and others. In all these cases, the PC is incremented by the
size of the instruction; always incrementing the PC by 4 is a natural
consequence when every instruction is 4 bytes.
The PC is incremented after reading the instruction, not before. After
the instruction is decoded, its size is known. Obtaining the instruction
size can be hard (as in x86, in which each byte might say there are more
bytes to read) or easy (which is the case in RISC-V, where the first
16-bit parcel of the instruction has bits specifying the size in a fixed
location).
The details for RISC-V are in the Introduction chapter of the RISC-V
Instruction Set Manual. If you haven't read it yet, I suggest doing so
first (at least the Introduction and the Base Integer Instruction Set
chapters), instead of trying to learn by reverse-engineering instruction
dumps.
--
Cesar Eduardo Barros
ces...@cesarb.eti.br