The constant zero is now usable wherever a GPR is expected and will be treated as $zero.
This fixes PR22389.
Differential D7295
[mips][ias] Make immediate zero synonymous with $zero when parsing registers. dsanders on Jan 30 2015, 7:54 AM. Authored by
Details
The constant zero is now usable wherever a GPR is expected and will be treated as $zero. This fixes PR22389.
Diff Detail Event TimelineComment Actions I'm not sure if we should do this. If Ed thinks it would be useful for him to have his particular use case fixed sooner rather than later, then LGTM with the inlined changes. Also, adding some FIXME's to the source code which mention the BNE+Imm macro would be useful.
Comment Actions
I hadn't thought of that one. I was thinking of things like 'addu $2, 0, $2' and instructions that don't have immediate forms. I'm a little on the fence as to whether I agree it's strange or not. True, it's syntax that GAS doesn't accept but I like the way it suggests that the result is still zero after the instruction because constants don't change.
You've also touched on another good reason to not do this patch there. If it generates different opcodes compared to the immediate forms of instructions then it will be harder to verify our assembler by comparing object files. Comment Actions
I'm just not keen on introducing such an exception to our handling of the MIPS assembly "type" system. However, as you yourself have mentioned, there are other stronger reasons to not make this change. |
Actually, I believe you can do this because you have access to the MipsAsmParser, so you can call AsmParser.isGP64bit().