Place the BlockAddress type in the address space of the containing function
authorAlex Richardson <Alexander.Richardson@cl.cam.ac.uk>
Fri, 2 Jul 2021 10:25:43 +0000 (11:25 +0100)
committerAlex Richardson <Alexander.Richardson@cl.cam.ac.uk>
Fri, 2 Jul 2021 11:17:55 +0000 (12:17 +0100)
commitc142c06c19b3725f26f33652db098a2302586f22
tree3143c94617ef9340e7f5144ecc21f6470b48ae88
parent791ddb79f1dde3432f6214c1c8deadc59151b15e
Place the BlockAddress type in the address space of the containing function

While this should not matter for most architectures (where the program
address space is 0), it is important for CHERI (and therefore Arm Morello).
We use address space 200 for all of our code pointers and without this
change we assert in the SelectionDAG handling of BlockAddress nodes.

It is also useful for AVR: previously programs targeting
AVR that attempt to read their own machine code
via a pointer to a label would instead read from RAM
using a pointer relative to the the start of program flash.

Reviewed By: dylanmckay, theraven
Differential Revision: https://reviews.llvm.org/D48803
llvm/docs/LangRef.rst
llvm/include/llvm/AsmParser/LLParser.h
llvm/lib/AsmParser/LLParser.cpp
llvm/lib/IR/Constants.cpp
llvm/test/Bitcode/blockaddress-addrspace.ll [new file with mode: 0644]
llvm/test/CodeGen/AVR/block-address-is-in-progmem-space.ll [new file with mode: 0644]
llvm/test/CodeGen/AVR/brind.ll