This is an archive of the discontinued LLVM Phabricator instance.

[mips] Support `micromips` attribute
ClosedPublic

Authored by atanasyan on May 19 2017, 10:12 AM.

Details

Summary

This patch adds support for the micromips and nomicromips attributes for MIPS targets.

Diff Detail

Repository
rL LLVM

Event Timeline

atanasyan created this revision.May 19 2017, 10:12 AM
sdardis added inline comments.May 20 2017, 2:26 PM
include/clang/Basic/AttrDocs.td
1277–1278

instructs the backend to locally select or turn off microMIPS code generation.

I think we can improve this to:

"instructs the backend to generate or not to generate microMIPS code for that function."

lib/Sema/SemaDeclAttr.cpp
5945

This is incorrect. microMIPS can be used to support interrupt handlers as the instruction set supports returning from an exception with 'eret'. MIPS16e lacks the 'eret' instruction, so it cannot be used with an interrupt handler function.

Aside: it is implementation dependant which ISAmode is used when an interrupt occurs on a processor supporting microMIPS and MIPS32R3 from my reading of the specification.

atanasyan updated this revision to Diff 99703.May 21 2017, 2:01 PM

Thanks for review.

This changes:

  • Allow simultaneous using of micromips and interrupt attributes.
  • Fix wording of micromips attribute description.
sdardis accepted this revision.May 22 2017, 3:26 AM

LGTM.

This revision is now accepted and ready to land.May 22 2017, 3:26 AM
This revision was automatically updated to reflect the committed changes.