[llvm-dev] get function parameters (not arguments)

Mohammad Norouzi via llvm-dev llvm-dev at lists.llvm.org
Fri Mar 10 08:12:13 PST 2017


What if I use -O0? In this case, there should be a load for each parameter
before the function call, yes?

Thank you and best,
Mo

On Fri, Mar 10, 2017 at 5:09 PM, Tim Northover <t.p.northover at gmail.com>
wrote:

> On 10 March 2017 at 08:06, Mohammad Norouzi <mnmomn at gmail.com> wrote:
> > what about the memory address of e and f? can i get them?
>
> Not in general, again. After optimizations they probably won't even
> have a fixed memory address. For example on AArch64 that code might
> become something like:
>
>     main:
>         mov w0, #10
>         mov w1, #22
>         bl foo
>         ret
>
> Where e and f only ever exist in registers.
>
> In some cases you might get lucky and see that the Value used in the
> call came from a load instruction, and then you could get its address
> from that. But it's not something you can rely on for correctness.
>
> Cheers.
>
> Tim.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170310/dfa1ee12/attachment-0001.html>


More information about the llvm-dev mailing list