[PATCH] D116551: [AVR] Mark call-clobbered registers as clobbered in interrupt handlers

Ayke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 3 11:40:31 PST 2022


aykevl created this revision.
aykevl added reviewers: dylanmckay, benshi001, Rahix.
Herald added subscribers: luke957, luismarques, s.egerton, Jim, PkmX, simoncook, hiraditya.
aykevl requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

I have matched the RISCV backend, which only uses the interrupt save
list in getCalleeSavedRegs, _not_ in getCallPreservedMask. I don't know
the details of these two methods, but with it, the correct amount of
registers is saved and restored.

Without this patch, practically all interrupt handlers that call a
function will miscompile.

I have added a test to verify this behavior. I've also added a very
simple test to verify that more normal interrupt operations (in this
case, incrementing a global value) behave as expected.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D116551

Files:
  llvm/lib/Target/AVR/AVRCallingConv.td
  llvm/lib/Target/AVR/AVRRegisterInfo.cpp
  llvm/test/CodeGen/AVR/interrupts.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116551.397118.patch
Type: text/x-patch
Size: 3326 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220103/61ae8797/attachment.bin>


More information about the llvm-commits mailing list