A side-effect of this is that LA gains proper handling of unsigned and positive signed 16-bit immediates and more accurate error messages.
Details
Diff Detail
Event Timeline
Thanks for combining these two. I've got a few comments but they are all fairly minor.
lib/Target/Mips/AsmParser/MipsAsmParser.cpp | ||
---|---|---|
1721–1723 | We don't really need the MCOperand's. We could have an int64_t for ImmOp and unsigned for the two register operands. This would also remove the need to allow nullptr in SrcRegOp since we could use Mips::NoRegister instead. | |
1743 | Mips::ZERO should be Mips::ZERO64 on 64-bit targets. Likewise for the bitwise operations below but not for ADDiu. Also, I'd suggest having SrcReg default to Mips::ZERO or Mips::ZERO64 and renaming UseSrcReg to SrcRegIsNotZero. | |
1768–1775 | This could be done in a follow-up patch, but all of the cases below this one end with the same code to generate an ADDu. We could factor it out fairly easily. | |
1850–1861 | Similar to expandLoadAddressReg(), most of these pointers ought to be references and passed to loadImmediate() as, for example, &ImmOp or ImmOp->getImm() | |
1865–1904 | Could you switch these back to references? You can always pass, for example, &ImmOp or ImmOp->getImm() into loadImmediate(). |
Replied to inline comments.
lib/Target/Mips/AsmParser/MipsAsmParser.cpp | ||
---|---|---|
1721–1723 | Done. | |
1743 | Essentially done. | |
1768–1775 | Done. | |
1850–1861 | Done. | |
1865–1904 | Done. |
LGTM with/without an optional nit.
lib/Target/Mips/AsmParser/MipsAsmParser.cpp | ||
---|---|---|
1743 | Good point. I'd slightly prefer it for tidyness but it's a very slight preference so consider it optional. |
We don't really need the MCOperand's. We could have an int64_t for ImmOp and unsigned for the two register operands. This would also remove the need to allow nullptr in SrcRegOp since we could use Mips::NoRegister instead.