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

Ben Shi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 25 00:42:19 PST 2022


benshi001 added inline comments.


================
Comment at: llvm/lib/Target/AVR/AVRFrameLowering.cpp:155
   if (AFI->isInterruptOrSignalHandler()) {
-    if (!MRI.reg_empty(AVR::R1)) {
-      BuildMI(MBB, MBBI, DL, TII.get(AVR::POPRd), AVR::R1);
+    if (!STI.hasTinyEncoding() && !MRI.reg_empty(STI.getZeroRegister())) {
+      // See emitPrologue: this is only needed on non-avrtiny chips.
----------------
I do see avr-gcc save/restore the zero-reg on avrtiny interrupt handlers. Shall we conform with avr-gcc ?


================
Comment at: llvm/test/CodeGen/AVR/features/avr-tiny.ll:2
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -mattr=avrtiny -O0 < %s -mtriple=avr | FileCheck %s
 
----------------
How about also testing atmega328, as a contrast to avrtiny ?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138582/new/

https://reviews.llvm.org/D138582



More information about the llvm-commits mailing list