[llvm-dev] How to generate a .ll file with functions' parameter names

Alberto Barbaro via llvm-dev llvm-dev at lists.llvm.org
Mon Dec 9 05:47:33 PST 2019


Hi David,
I think it should be a feasible solution. I'll make some experiment soon.

If tutorials for this topic are not available it would be great to have
them.

Thanks a lot for your help
Alberto

On Mon, Dec 9, 2019, 12:51 David Chisnall <David.Chisnall at cl.cam.ac.uk>
wrote:

> Hi,
>
> If you're not worried about the mapping to C parameters, then you should
> be able to start with the SSA values for the parameters and then walk
> the def-use chains to find everything that depends on it (modulo things
> that depend on it as a result of control flow or memory stores and loads).
>
> David
>
> On 09/12/2019 11:29, Alberto Barbaro wrote:
> > Hi David,
> > Thanks for your email. I'm just trying to perform some basic analysis on
> > the IR. For instance, is it possible to understand if the variable %10
> > depends on the value of the first parameter? I know that the first
> > parameter can be referenced as %0 but a proper name would increase the
> > readability. It is not so crucial for me atm.
> >
> > Thanks
> > Alberto
> >
> > On Mon, Dec 9, 2019, 11:01 David Chisnall via llvm-dev
> > <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote:
> >
> >     Hi Alberto,
> >
> >     Note that even with this, there isn't necessarily a 1:1
> correspondence
> >     between LLVM IR parameters and clang parameters.  For example, a
> struct
> >     passed by value in a C function may be one IR parameter per field, or
> >     may be packed into an integer large enough to store the whole thing.
> >     Similarly, return values may be indirect via sret pointers or they
> may
> >     be explicit return values but of a different type (for example, on
> i386
> >     a return of struct of a pair of int- or pointer-sized values may be
> >     returned as a single i64 in LLVM IR).
> >
> >     It would help to understand what you are trying to do, because there
> >     may
> >     be a better way of achieving your goal.
> >
> >     David
> >
> >
> >     On 08/12/2019 10:19, Alberto Barbaro via llvm-dev wrote:
> >      > Hi Tim,
> >      > My bad, I have installed a newer version of clang and all worked.
> >      >
> >      > Thanks
> >      >
> >      > On Sun, Dec 8, 2019, 10:05 Tim Northover <t.p.northover at gmail.com
> >     <mailto:t.p.northover at gmail.com>
> >      > <mailto:t.p.northover at gmail.com
> >     <mailto:t.p.northover at gmail.com>>> wrote:
> >      >
> >      >     On Sun, 8 Dec 2019 at 09:54, Alberto Barbaro via llvm-dev
> >      >     <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>
> >     <mailto:llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>>>
> >     wrote:
> >      >      > thanks for your answer. Unfortunately I'm still using llvm
> 6.0
> >      >     and in llvm-dis I don't see that option. I tried reading the
> full
> >      >     list of options but I didn't see an alternative.
> >      >
> >      >     The option is for Clang. Once you have the IR generated it's
> >     too late,
> >      >     the names will already have been discarded.
> >      >
> >      >     Cheers.
> >      >
> >      >     Tim.
> >      >
> >      >
> >      > _______________________________________________
> >      > LLVM Developers mailing list
> >      > llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>
> >      > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
> >      >
> >     _______________________________________________
> >     LLVM Developers mailing list
> >     llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>
> >     https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191209/6624c1a8/attachment.html>


More information about the llvm-dev mailing list