]> granicus.if.org Git - llvm/commit
[AVR] Fix displacement overflow for LDDW/STDW
authorDylan McKay <me@dylanmckay.io>
Wed, 4 Oct 2017 09:51:21 +0000 (09:51 +0000)
committerDylan McKay <me@dylanmckay.io>
Wed, 4 Oct 2017 09:51:21 +0000 (09:51 +0000)
commit28edec75f190a47609c0c359385be0e6dcb49f67
treeb29d4cea38b96dfc3dbef07d1416e143951abfb5
parent78762a19e4c57d30a05b27c8d5bbd98abb56c284
[AVR] Fix displacement overflow for LDDW/STDW

In some cases, the code generator attempts to generate instructions such as:

lddw r24, Y+63

which expands to:

ldd r24, Y+63
ldd r25, Y+64 # Oops! This is actually ld r25, Y in the binary

This commit limits the first offset to 62, and thus the second to 63.
It also updates some asserts in AVRExpandPseudoInsts.cpp, including for
INW and OUTW, which appear to be unused.

Patch by Thomas Backman.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314890 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/AVR/AVRExpandPseudoInsts.cpp
lib/Target/AVR/AVRRegisterInfo.cpp
test/CodeGen/AVR/std-ldd-immediate-overflow.ll [new file with mode: 0644]