Carter Cheng via llvm-dev
2019-Nov-01 17:19 UTC
[llvm-dev] getting address of parameter or return memory cell on stack in bitcode
Hello LLVM Developers, 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. If these things are possible how is it done in a safe manner? Thanks, Carter. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191102/1afca95b/attachment.html>
Tim Northover via llvm-dev
2019-Nov-01 19:01 UTC
[llvm-dev] getting address of parameter or return memory cell on stack in bitcode
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.
Carter Cheng via llvm-dev
2019-Nov-01 20:34 UTC
[llvm-dev] getting address of parameter or return memory cell on stack in bitcode
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> wrote:> 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>
Maybe Matching Threads
- RFC: Opaque pointer status and future direction
- RFC: Opaque pointer status and future direction
- Finding line numbers in source code associated with given bitcode instructions
- [LLVMdev] Starting implementation of 'inalloca' parameter attribute for MS C++ ABI pass-by-value
- [RFC] Replacing inalloca with llvm.call.setup and preallocated