[PATCH] D138582: [AVR] Do not use R0/R1 on avrtiny

Ayke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 23 08:42:33 PST 2022


aykevl created this revision.
aykevl added reviewers: dylanmckay, benshi001.
Herald added subscribers: Jim, hiraditya.
Herald added a project: All.
aykevl requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This patch makes sure the compiler uses R16/R17 <https://reviews.llvm.org/source/LLVM.org/> on avrtiny (attiny10 etc) instead of R0/R1 <https://reviews.llvm.org/diffusion/L/>.

Some notes:

- This patch also modifies the interrupt prologue/epilogue code to not save/clear/restore the zero register, because that's not needed on avrtiny. The zero register is at all times zero (unlike on non-avrtiny where it is clobbered by the multiplication instruction).
- For the NEGW and ROLB instructions, it relies on the fact that R1 <https://reviews.llvm.org/diffusion/L/> is always zero on avrtiny. This is slightly ugly, but it should be safe.
- Not entirely sure about putting all tests in features/avr-tiny.ll, but it doesn't seem like the "target-cpu"="attiny10" attribute works.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D138582

Files:
  llvm/lib/Target/AVR/AVRExpandPseudoInsts.cpp
  llvm/lib/Target/AVR/AVRFrameLowering.cpp
  llvm/lib/Target/AVR/AVRISelLowering.cpp
  llvm/lib/Target/AVR/AVRISelLowering.h
  llvm/lib/Target/AVR/AVRInstrInfo.td
  llvm/lib/Target/AVR/AVRRegisterInfo.cpp
  llvm/lib/Target/AVR/AVRSubtarget.h
  llvm/test/CodeGen/AVR/features/avr-tiny.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138582.477516.patch
Type: text/x-patch
Size: 20840 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221123/78362f5c/attachment.bin>


More information about the llvm-commits mailing list