This is an archive of the discontinued LLVM Phabricator instance.

[mips][microMIPS] Extending size reduction pass with ADDIUSP and ADDIUR1SP
ClosedPublic

Authored by milena.vujosevic.janicic on Jun 22 2017, 6:25 AM.

Details

Summary

The patch extends size reduction pass for MicroMIPS.
The following instructions are examined and transformed, if possible:
ADDIU instruction is transformed into 16-bit instruction ADDIUSP
ADDIU instruction is transformed into 16-bit instruction ADDIUR1SP
Function InRange is changed to avoid left shifting of negative values, since
that caused some sanitizer tests to fail (so the previous patch
https://reviews.llvm.org/D33887 was reverted).

Diff Detail

Repository
rL LLVM

Event Timeline

sdardis added inline comments.Jun 27 2017, 5:17 AM
lib/Target/Mips/MicroMipsSizeReduction.cpp
426 ↗(On Diff #103564)

This is common between the two branches of the if, so it can be hoisted above the if.

429 ↗(On Diff #103564)

This is common too, so it should be hoisted up.

462–463 ↗(On Diff #103564)

Formatting: Break overly long conditional statements _after_ the '||' or '&&' operators, not before. i.e. This should be:

if (!Subtarget->inMicroMipsMode() || !Subtarget->hasMips32r2() ||
    Subtarget->hasMips32r6())

clang-format handles this.

All the comments are taken into account.

sdardis accepted this revision.Jul 4 2017, 7:45 AM

LGTM with nit addressed.

lib/Target/Mips/MicroMipsSizeReduction.cpp
443 ↗(On Diff #104366)

Needs:

} else
  llvm_unreachable("Unknown operand transfer!");
This revision is now accepted and ready to land.Jul 4 2017, 7:45 AM
This revision was automatically updated to reflect the committed changes.