[llvm-dev] getting address of parameter or return memory cell on stack in bitcode

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Fri Nov 1 12:01:52 PDT 2019


Hi Carter,

On Fri, 1 Nov 2019 at 17:19, Carter Cheng via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> I am curious if it is possible to get the actual address in memory of where the parameter or return memory location is on to the stack prior to the call or return being made in the LLVM IR.

I suspect the answer depends on what you're hoping to do with that information.

The "inalloca" attribute was added for a particular Windows use-case
(where the ABI demanded the caller modify that memory in arbitrary
ways before the call), and might be useful if you control the
front-end or at least can insert a conversion pass without breaking an
existing ABI you care about.

Alternatively, the information is available at certain stages in the
CodeGen. During call-lowering the offsets are assigned (as "some
target-specific stack offset + N"); the targets generally know what
that specific stack offset is and can go digging around if they want.

So what do you plan to do with this information if you can obtain it?

Cheers.

Tim.


More information about the llvm-dev mailing list