[AVR] Support most address space casts
authorAyke van Laethem <aykevanlaethem@gmail.com>
Thu, 19 Jan 2023 13:49:43 +0000 (14:49 +0100)
committerAyke van Laethem <aykevanlaethem@gmail.com>
Tue, 24 Jan 2023 17:41:14 +0000 (18:41 +0100)
commit8202a3da3c897fc663f55ae5c638ae56f11543c1
tree90e0f0cd20daede81c6cacc6f3b7085f8bbe6685
parentca8b0b4af42499669573fdfe6e3bb87feb2f6b69
[AVR] Support most address space casts

All hardware address spaces on AVR can be freely cast between (they keep
the same bit pattern). They just aren't dereferenceable when they're in
a different address space as they really do point to a separate address
space.

This is supported in avr-gcc: https://godbolt.org/z/9Gfvhnhv9

avr-gcc also supports the `__memx` address space which is 24 bits. We
don't support this address space yet but I've added a safeguard just in
case.

Differential Revison: https://reviews.llvm.org/D142107
llvm/lib/Target/AVR/AVRTargetMachine.h
llvm/test/CodeGen/AVR/addrspacecast.ll [new file with mode: 0644]