Implement 16-bit microMIPS load immediate instruction LI16.
Details
Diff Detail
Event Timeline
Just one more thing that I noticed, and it applies to the previous patches too. You check whether the immediate operand is correct in the method MipsAsmParser::processInstruction, which is called after the instruction has already been parsed. This makes the error message not quite correct because the marker in the message that marks the position where the error happened is positioned not on the operand but on the start of the instruction. I think the proper way to handle this is to create AsmOperandClass for the operand and define custom ParserMethod, which would issue the error when the operand is being parsed. Since I already gave LGTM for several patches where this happens, you should at least add a TODO comment for this.
I think the proper way to handle this is to create AsmOperandClass for the operand and define custom ParserMethod, which would issue the error when the operand is being parsed.
You need a custom predicate (AsmOperandClass.PredicateMethod) rather than a custom parser. If you need to transform the number you can do this with AsmOperandClass.RenderMethod. Other targets also use the value of AsmOperandClass.DiagnosticType in the switch in MatchAndEmitInstruction to emit better diagnostics on a match failure but I haven't tried this yet.