<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 7/17/15 8:32 PM, Shen Liu wrote:<br>
</div>
<blockquote
cite="mid:CAHxbscv-QLYFnJG9wYw7i=cJMb3Jg04m_Ep5eVtX_ir_C=vHeg@mail.gmail.com"
type="cite">
<div dir="ltr">John, thanks for your helpful advice.
<div><br>
</div>
<div>My ultimate goal is to construct a full instruction-level
program dependence graph for a given IR file. The hard point
is how to establish the correct data dependence edges when
some function arguments are multi-level pointers. To solve
this problem I hope to check the point-to level for each
pointer variable. I think the data dependence through pointers
can be described more accurately in this way. Unfortunately i
didn't find any available interface to finish this job, so i
guess i have to write it by myself. <br>
</div>
</div>
</blockquote>
<br>
It sounds like you need a shape graph. DSA can provide that, and it
currently works with LLVM mainline. You can find it in the
poolalloc module (svn co
<a class="moz-txt-link-freetext" href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_svn_llvm-2Dproject_poolalloc_trunk&d=AwMDaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=ChRwZgH9ydHSzb3FOSm7tnmQKoJ9nwFnVZRaTLDkDbQ&s=-UVkvQ4U79LreQ7sKg5QcFjk_htmWQdKsS-v_o14d0M&e=">http://llvm.org/svn/llvm-project/poolalloc/trunk</a> poolalloc) or a
slightly older version on my Github page
(<a class="moz-txt-link-freetext" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_jtcriswell_llvm-2Ddsa&d=AwMDaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=ChRwZgH9ydHSzb3FOSm7tnmQKoJ9nwFnVZRaTLDkDbQ&s=LIXm5MixPyx_KmJwR0Vn4FqcJS_swaJuVGCEZIW7ws0&e=">https://github.com/jtcriswell/llvm-dsa</a>). Please note that the
version from LLVM SVN will only compile lib/DSA. I don't think
anyone has brought lib/PoolAllocate up to date.<br>
<br>
There is documentation which gives a very basic overview of the DSA
passes and how to use the shape graph.<br>
<br>
The open question is whether DSA will be sufficiently accurate for
your needs. Of that, I'm not sure. You would need to try it out
and see if it's sufficient accurate for you.<br>
<br>
Regards,<br>
<br>
John Criswell<br>
<br>
<br>
<blockquote
cite="mid:CAHxbscv-QLYFnJG9wYw7i=cJMb3Jg04m_Ep5eVtX_ir_C=vHeg@mail.gmail.com"
type="cite">
<div dir="ltr">
<div> </div>
<div><br>
</div>
<div>Best regards,</div>
<div><br>
</div>
<div>Shen</div>
<div><br>
</div>
<div><br>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Fri, Jul 17, 2015 at 2:22 PM, John
Criswell <span dir="ltr"><<a moz-do-not-send="true" href="mailto:jtcriswel@gmail.com" target="_blank">jtcriswel@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"><span class="">
<div>On 7/17/15 1:06 PM, Shen Liu wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr"> John, thanks for you answer! But as
far as I know LLVM doesn't provide any interface for
finding the pointee of a pointer directly, so i have
to process a multi-level pointer i need to write my
own function to check pointers level by level, is
that right?<br>
</div>
</blockquote>
<br>
</span> I'm not sure what you're trying to do. If you're
trying to determine the LLVM pointer type and the LLVM
type to which it points, what I've said will work.<br>
<br>
If you're trying to do something more complicated, then
you need to explain more clearly what you want to do. I
think it would also help if you "jumped up a level" and
explained what your end goal is so that the community can
give you better advice. Based on your previous emails, it
seems like you're asking very specific questions instead
of asking how to best achieve your overall goal.<br>
<br>
Regards,<br>
<br>
John Criswell<span class=""><br>
<br>
<br>
<blockquote type="cite">
<div class="gmail_extra"><br>
<div class="gmail_quote">On Fri, Jul 17, 2015 at
1:47 PM, John Criswell <span dir="ltr"><<a moz-do-not-send="true" href="mailto:jtcriswel@gmail.com" target="_blank">jtcriswel@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote">
<div><span>
<div>On 7/17/15 12:38 PM, Shen Liu wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Hi all, as a LLVM beginner
I would like to know how can i check the
pointer types with different levels like
int 32* and int 32**, int 32***?
<div><br>
</div>
<div>By using
value->getType()->isPointerTy()
i can just know they are pointers. But
the dump results clearly show they are
different. Is there a good way to
calculate their actual point to
levels? Thanks!</div>
</div>
</blockquote>
<br>
</span> You will need to use
dyn_cast<PointerType> to cast the Type *
into a PointerType *. Once you do that, you
can find the Type * that the PointerType
points to.<br>
<br>
Regards,<br>
<br>
John Criswell<br>
<br>
<blockquote type="cite">
<div dir="ltr">
<div><br>
</div>
<div><br>
</div>
<div>Best regards,</div>
<div><br>
</div>
<div>Shen</div>
</div>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
LLVM Developers mailing list
<a moz-do-not-send="true" href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a> <a moz-do-not-send="true" href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a>
<a moz-do-not-send="true" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><span>
</span></pre>
<span> </span></blockquote>
<span> <br>
<br>
<pre cols="72">--
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
<a moz-do-not-send="true" href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.cs.rochester.edu_u_criswell&d=AwMDaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=ChRwZgH9ydHSzb3FOSm7tnmQKoJ9nwFnVZRaTLDkDbQ&s=W2GnWGPcsrWchOUfBE5IOuW6IjDJZvp2-SqnmNYLsCk&e=" target="_blank">http://www.cs.rochester.edu/u/criswell</a></pre>
</span></div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
<br>
<pre cols="72">--
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
<a moz-do-not-send="true" href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.cs.rochester.edu_u_criswell&d=AwMDaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=ChRwZgH9ydHSzb3FOSm7tnmQKoJ9nwFnVZRaTLDkDbQ&s=W2GnWGPcsrWchOUfBE5IOuW6IjDJZvp2-SqnmNYLsCk&e=" target="_blank">http://www.cs.rochester.edu/u/criswell</a></pre>
</span></div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
<a class="moz-txt-link-freetext" href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.cs.rochester.edu_u_criswell&d=AwMDaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=ChRwZgH9ydHSzb3FOSm7tnmQKoJ9nwFnVZRaTLDkDbQ&s=W2GnWGPcsrWchOUfBE5IOuW6IjDJZvp2-SqnmNYLsCk&e=">http://www.cs.rochester.edu/u/criswell</a></pre>
</body>
</html>