Page MenuHomePhabricator

Add disassembler support for micromips16 andi16, addiusp, jraddiusp instructions.
ClosedPublic

Authored by vmedic on Nov 26 2014, 2:50 AM.

Details

Summary

The listed instructions were missing dedicated decoder methods in MipsDisassembler.cpp to properly decode immediate operands. These methods are added together with corresponding tests.

Diff Detail

Event Timeline

vmedic updated this revision to Diff 16639.Nov 26 2014, 2:50 AM
vmedic retitled this revision from to Add disassembler support for micromips16 andi16, addiusp, jraddiusp instructions..
vmedic updated this object.
vmedic edited the test plan for this revision. (Show Details)
vmedic added a subscriber: Unknown Object (MLST).
sstankovic added inline comments.Nov 27 2014, 2:41 AM
lib/Target/Mips/Disassembler/MipsDisassembler.cpp
313

Align the parameters.

316

Same here.

319

Same here (and few more cases below).

1459

For the following instructions the immediate is wrongly disassembled:

addiusp 1024
addiusp 1028
addiusp -1028
addiusp -1032

if they are assembled with llvm-mc (or gcc) and then disassembled with llvm-objdump, the result is

addiusp 0
addiusp 4
addiusp -4
addiusp -8

Please include these instructions in both assemble and disassemble tests.

lib/Target/Mips/MicroMipsInstrInfo.td
11–12

Add one more 'm' in method name: DecodeUImm5lsl2

vmedic updated this revision to Diff 16688.Nov 27 2014, 5:51 AM

Bug in DecodeSimm9SP code fixed, style remarks applied. Test cases for specific values added for both assembler and disassembler.

sstankovic edited edge metadata.Nov 27 2014, 7:56 AM

LGTM, with two changes.

lib/Target/Mips/Disassembler/MipsDisassembler.cpp
319

This line is unaligned.

1464

For 0, 1, 510 and 511, you can just use unshifted decoded values. For example,

case 0: DecodedValue = 256; break;
case 1: DecodedValue = 257; break;
case 510: DecodedValue = -258; break;
case 511: DecodedValue = -257; break;
sstankovic accepted this revision.Nov 27 2014, 7:56 AM
sstankovic edited edge metadata.
This revision is now accepted and ready to land.Nov 27 2014, 7:56 AM
vmedic closed this revision.Dec 1 2014, 3:13 AM

Committed revision 223006.