Introducing the slot indexes
If you look at the Machine IR dumps, you will notice that some of them feature numbers in front of the MachineInstr instance.
The following snippet shows one such dump:
0B bb.0 (%ir-block.1):
...
16B %3:gpr32 = COPY $w0
...
224B B %bb.1
240B bb.1 (%ir-block.5):
256B ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
These numbers are the slot indexes. Notice how the numbering keeps growing despite the change in the basic block. For instance, the end of the first basic block is at the slot index 224B, and the second basic block starts right after, at 240B.
The slot indexes are a somewhat continuous numbering of all the instructions in the MachineFunction instance. Each instruction is assigned a number, a slot index, and that number is guaranteed to increase monotonically with the linear order of the MachineFunction instance. In other words, if an instruction, I, has a slot index with a smaller value than another instruction...