[AVR] Respect the 'interrupt' function attribute
authorDylan McKay <me@dylanmckay.io>
Tue, 31 Mar 2020 06:00:18 +0000 (19:00 +1300)
committerDylan McKay <me@dylanmckay.io>
Tue, 31 Mar 2020 06:00:18 +0000 (19:00 +1300)
commit339b34266c1b54a9b5ff2f83cfb1da9cd8c9d90a
tree6e4c9903dabeaef90632e208bd04fd2fce0a63de
parentebad678857a94c32ce7b6931e9c642b32d278b67
[AVR] Respect the 'interrupt' function attribute

In the past, AVR functions were only lowered with interrupt-specific
machine code if the function was defined with the "avr-interrupt" or
"avr-signal" calling conventions.

This patch modifies the backend so that if the function does not have a
special calling convention, but does have an "interrupt" attribute,
that function is interpreted as a function with interrupts.

This also extracts the "is this function an interrupt" logic from
several disparate places in the backend into one AVRMachineFunctionInfo
attribute.

Bug found by Wilhelm Meier.
llvm/lib/Target/AVR/AVRFrameLowering.cpp
llvm/lib/Target/AVR/AVRISelLowering.cpp
llvm/lib/Target/AVR/AVRMachineFunctionInfo.h
llvm/lib/Target/AVR/AVRRegisterInfo.cpp
llvm/test/CodeGen/AVR/interrupts.ll