-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Safety of convenience macros #190
Comments
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.
|
(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. |
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.
The text was updated successfully, but these errors were encountered: