[PATCH] D117426: [AVR] Only push and clear R1 in interrupts when necessary
Ayke via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 16 04:40:27 PST 2022
aykevl created this revision.
aykevl added reviewers: dylanmckay, benshi001.
Herald added subscribers: Jim, hiraditya.
aykevl requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
`r1` is a reserved register, but LLVM gives the APIs to know when it is used or not. So this patch uses these APIs to only save/clear/restore `r1` in interrupts when necessary.
The main issue here was getting inline assembly to work. One could argue that this is the job of Clang, but for consistency I've made sure that `r1` is always usable in inline assembly even if that means clearing it when it might not be needed.
Information on inline assembly in AVR can be found here:
https://www.nongnu.org/avr-libc/user-manual/inline_asm.html#asm_code
Essentially, this seems to suggest that `r1` can be freely used in avr-gcc inline assembly, even without specifying it as an input operand.
---
This patch depends on D117425 <https://reviews.llvm.org/D117425>.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D117426
Files:
llvm/lib/Target/AVR/AVRExpandPseudoInsts.cpp
llvm/lib/Target/AVR/AVRFrameLowering.cpp
llvm/lib/Target/AVR/AVRISelDAGToDAG.cpp
llvm/lib/Target/AVR/AVRISelLowering.cpp
llvm/lib/Target/AVR/AVRInstrInfo.td
llvm/test/CodeGen/AVR/interrupts.ll
llvm/test/CodeGen/AVR/pseudo/NEGWRd.mir
llvm/test/CodeGen/AVR/pseudo/ROLBrd.mir
llvm/test/CodeGen/AVR/zeroreg.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117426.400371.patch
Type: text/x-patch
Size: 14131 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220116/11041d90/attachment.bin>
More information about the llvm-commits
mailing list