Safety of convenience macros
The branch convenience macros are said to use sltu etc. This means they clobber a register, and the docs do not say which. This is a problem for RSP and other such platforms where there is no ABI to follow, and all registers may be in use.
They use $at / r1. This indeed should be documented.
If you're in a context where $at cannot be safely used as the assembler temporary, you should not use any assembler macros. This register is normally reserved for this purpose.
-[Unknown]
How can you know what is a macro and what isn't? The names are very similar to instructions.
Thus this is a multi-part request.
- document which reg is used
- add a warning: if the file uses both a macro and the r1 register, print a warning
- add a directive that disables all such dangerous macros (note: not all macros)
(I can't edit) the warning should only be if a dangerous macro is used naturally, not any macro.
I feel documenting that the macros may use r1 for temporary values (as specified by the standard MIPS ABI) is enough here. If the code doesn't conform to the standard ABI then the usage of convenience macros is the risk of the user. The proposed warnings would have both false positives (when your own code uses r1 for a temporary value in another place) and false negatives (when code that isn't changed relies on r1 being unchanged).
A directive for disabling MIPS macros could be worth having though.
Please only have it disable the dangerous macros; li, la, the load/store ones don't clobber, I believe.
The store macros clobber r1 as well since they need a register for storing the upper half of the address, and unlike loads they can not use the load destination register for that.