Introduction
MIPS assemblers accept many names that are not instructions: they are another spelling of an instruction, or a short sequence of them. A disassembler that writes the short name makes code easier to read; one that writes the instruction as encoded is easier to check. The explorer's option “Pseudo-instructions” (on by default) chooses. The set below is the one llvm's disassembler writes, so the two can be compared; with the option off every word is shown as the instruction it encodes.
What the disassembler rewrites
| Written as | The instruction as encoded | When |
|---|---|---|
nop | sll $0, $0, 0 (all zero bits) | Always. Other sll $0, $0, n words are ssnop (n = 1), ehb (n = 3) and, from Release 2, pause (n = 5). |
move rd, rs | addu rd, rs, $0, or rd, rs, $0 or daddu rd, rs, $0 | Whenever the third register is $0. |
neg rd, rt, negu, dneg, dnegu | sub rd, $0, rt and the u and 64-bit forms | Whenever the first source is $0. |
not rd, rs | nor rd, rs, $0 | Whenever the second source is $0. |
b offset | beq $0, $0, offset | Always taken: the unconditional branch. |
beqz rs, offset, bnez, beqzl, bnezl | beq rs, $0, offset and the not-equal and likely forms | Whenever rt is $0. |
bal offset | bgezal $0, offset | The relative call. |
nal | bltzal $0, -1 (an offset that points at the next instruction) | Before Release 6; it is an instruction of its own in Release 6. |
jr rs | jalr $0, rs | When jalr does not keep the return address. jalr rs is written for jalr $ra, rs. The same for jr.hb and jalr.hb. |
jrc rt, jalrc rt | jic rt, 0, jialc rt, 0 | Release 6, when the offset is 0. |
dext, dins | dextm, dextu, dinsm, dinsu | Always: one assembler name for the three encodings of the 64-bit field instructions. |
What it does not rebuild
An assembler also turns a name into several instructions: li $t0, 0x12345678 is lui and ori;
la is lui and addiu (or a $gp-relative form); blt and its relatives are slt and a branch; lw $t0, label and
the immediate forms of add and sub are macros too. The disassembler works on one word at a time and does not fold such sequences, so these
appear as the instructions that make them up. addiu rt, $0, imm (li for a small value) is also written as it is encoded.
Not described
Known, not yet covered
- Viewer: combining a
luiwith theaddiu,orior memory instruction that completes the address, to show the whole constant or symbol.
Unknown
- Reference: none known.