For a description of the riscv-overlay system proposal: https://github.com/riscv-software-src/riscv-overlay/
This is the LLVM component of a change to add support for a proposed 'overlay' system for RISC-V to LLVM.
This adds two new function attributes to LLVM, 'overlay-call' and "overlay-data". These functions are used to mark functions and data which must be accessed indirectly through the overlay engine.
For global data marked as 'overlay-data' this change causes a different relocation types to be used when accessing the data. Instead of calculating the address of the data, these relocations calculate the value of the 'token' representing the data in the overlay engine.
For functions marked as 'overlay-call' a similar change occur - a 'token' is used instead of the function address for any references to an 'overlay-call' function, however there is also some additional complexity when handling 'overlay-call':
- Both calls to an 'overlay-call' function *or* from an 'overlay-call' function must go indirectly through the overlay engine.
- Calls into the overlay engine use a different calling convention. The entry point to the engine is in x31, and the token value for the target is stored to x30.
An additional change made here is to reserve a number of registers for exclusive used by the overlay engine.
Obviously can't be merged like this