I’m implementing a more secure calling convention (on the CHERI fork of llvm, but my question is applicable to vanilla llvm as well).
A part of this calling convention is returning using what is called an “activation record”, a small bundle of code and data placed on the stack which when executed restores the environment of the caller.
To construct this activation record I need to obtain a return address, ie the address of the first instruction after
As stated in the title, I am working in the
lowerCall() function (in
RISCVISelLowering.cpp), so the return address will have to be some variable which is filled in during machine code emission. My question is: where can I obtain that variable during call lowering?
If I can provide more information to illustrate the problem further, I am more than happy to do so.