<div dir="ltr"><br><div class="gmail_extra"><span class=""></span><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000"><span class=""><blockquote type="cite">
<div dir="ltr">
<div>Hi,<br>
<br>
I need to check if a variable belongs to the program
originally. Consider the following code line:<br>
<br>
</div>
<div>y = x + 4<br>
</div>
<div><br>
and its corresponding llvm ir (roughly):<br>
<br>
%16 = load i32 %x<br>
%add = add i32 %16, i32 4<br>
</div>
store i32 %add, %y<br>
<div>
<br>
I need to distinguish between %16, %add and %x, %y. <br>
</div>
</div>
</blockquote>
<br></span>
You might be able to use the Debug information embedded within the
LLVM IR to determine what is an original variable and what is a
temporary added by LLVM. However, I think that such an approach is
fragile.<br></div></blockquote><div><br></div><div>yes, Debug info provides lots of useful info and i think there should be sth about this case. But I don't know which api or method does this. <br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000">
<br>
It sounds like you need to be analyzing Clang ASTs instead of LLVM
IR. The Clang AST represents a program in its original source form,
so you can tell what is a program variable, in what file it was
defined, its original source type, etc.<br></div></blockquote><div><br></div><div>I'm not sure about Clang ASTs but this is part of an llvm pass which analyzes llvm IR. So, i doubt if i can use Clang AST.<br><br></div><div>Best,<br></div><div>Mohammad<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000">
<br>
Regards,<br>
<br>
John Criswell<br>
<br>
<blockquote type="cite"><span class="">
<div dir="ltr">
<div>
<br>
Any help is appreciated.<br>
<br>
Best,<br>
Mohammad</div>
</div>
<br>
<fieldset></fieldset>
<br>
</span><pre>_______________________________________________
LLVM Developers mailing list
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><span class=""><font color="#888888">
</font></span></pre><span class=""><font color="#888888">
</font></span></blockquote><span class=""><font color="#888888">
<br>
<br>
<pre cols="72">--
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
<a href="http://www.cs.rochester.edu/u/criswell" target="_blank">http://www.cs.rochester.edu/u/criswell</a></pre>
</font></span></div>
</blockquote></div><br></div></div>