This is an archive of the discontinued LLVM Phabricator instance.

[mips] Restrict the creation of compact branches
ClosedPublic

Authored by sdardis on May 16 2016, 6:35 AM.

Details

Summary

Restrict the creation of compact branches so that they meet the ISA encoding
requirements. Notably do not permit $zero to be used as a operand for compact
branches and ensure that some other branches fulfil the requirement that
rs != rt.

Fixup cases where $rs > $rt for bnec and beqc.

Diff Detail

Event Timeline

sdardis updated this revision to Diff 57343.May 16 2016, 6:35 AM
sdardis retitled this revision from to [mips] Restrict the creation of compact branches.
sdardis updated this object.
sdardis added a reviewer: dsanders.
sdardis set the repository for this revision to rL LLVM.
sdardis added a subscriber: llvm-commits.
dsanders accepted this revision.May 16 2016, 7:51 AM
dsanders edited edge metadata.

LGTM with a couple nits

lib/Target/Mips/Mips32r6InstrFormats.td
363

&& rs != 0

We can also say '&& rt != 0' if we want but the 'rs < rt' already covers it.

lib/Target/Mips/MipsInstrInfo.cpp
286–292

We can use MachineOperand::isReg() instead of the getType() checks.
We should check the number of operands since some instructions have one (e.g. B, PseudoReturn) or zero operands.

This revision is now accepted and ready to land.May 16 2016, 7:51 AM
sdardis closed this revision.May 18 2016, 2:28 AM
sdardis marked 2 inline comments as done.

Thanks, committed as rL269893.