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

Carter Cheng via llvm-dev llvm-dev at lists.llvm.org
Fri Nov 1 13:34:53 PDT 2019

Hello Tim,

Thanks for the reply. I am trying to write a compiler pass where I can
assign a "type" to variables on the stack, heap and globals without
modifying the form of the existing data. I assume the inalloca attribute
works for return values as well?

On Sat, Nov 2, 2019 at 4:02 AM Tim Northover <t.p.northover at gmail.com>

> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191102/582032b9/attachment.html>

More information about the llvm-dev mailing list