This is an archive of the discontinued LLVM Phabricator instance.

[mips][microMIPS] Implement LI16 instruction
ClosedPublic

Authored by jkolek on Sep 2 2014, 3:22 AM.

Details

Summary

Implement 16-bit microMIPS load immediate instruction LI16.

Diff Detail

Repository
rL LLVM

Event Timeline

jkolek updated this revision to Diff 13158.Sep 2 2014, 3:22 AM
jkolek retitled this revision from to [mips][microMIPS] Implement LI16 instruction.
jkolek updated this object.
jkolek edited the test plan for this revision. (Show Details)
jkolek added reviewers: dsanders, vmedic.
jkolek added a subscriber: zoran.jovanovic.
jkolek updated this revision to Diff 14274.Oct 1 2014, 5:15 AM
jkolek updated this object.
jkolek added a reviewer: sstankovic.
sstankovic accepted this revision.Oct 3 2014, 9:00 AM
sstankovic edited edge metadata.
This revision is now accepted and ready to land.Oct 3 2014, 9:00 AM

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.

dsanders edited edge metadata.Oct 8 2014, 8:14 AM

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.

Diffusion closed this revision.Oct 23 2014, 4:09 AM
Diffusion updated this revision to Diff 15314.

Closed by commit rL220475 (authored by zjovanovic).

jkolek edited edge metadata.Nov 18 2014, 5:58 AM
jkolek added a subscriber: Unknown Object (MLST).