[PATCH] D121672: [AVR] Reject/Reserve R0~R15 on AVRTiny

Ben Shi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 23 02:53:28 PDT 2022


benshi001 marked an inline comment as done.
benshi001 added inline comments.


================
Comment at: llvm/lib/Target/AVR/AVRCallingConv.td:39
 def CSR_Normal : CalleeSavedRegs<(add R29, R28, (sequence "R%u", 17, 2))>;
+def CSR_NormalTiny : CalleeSavedRegs<(add R29, R28, R19, R18)>;
 def CSR_Interrupts : CalleeSavedRegs<(add(sequence "R%u", 31, 2))>;
----------------
aykevl wrote:
> I don't think this is needed. Reserved registers are not part of the regular calling convention anyway.
Unfortunately this is a must. Since `R19` and `R18` are callee saved registers on avrtiny, according to https://gcc.gnu.org/wiki/avr-gcc#Reduced_Tiny, though they are not so on normal avr.

So we should explicitly mark `R19`/`R18` as callee saved for avrtiny, and exclude `R17`/`R16` from interrupt/singal_handler saved list.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121672



More information about the llvm-commits mailing list