Err.. Your right. What about just finding casts in general.<br><br><br><div><span class="gmail_quote">On 4/25/06, <b class="gmail_sendername">Chris Lattner</b> <<a href="mailto:sabre@nondot.org">sabre@nondot.org</a>> wrote:
</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">On Tue, 25 Apr 2006, John Trimble wrote:<br>> I'm trying to find all the implicit casts in a program compiled with
<br>> llvm-gcc.<br><br>I'm not sure exactly what you're trying to do here.  In particular,<br>llvm-gcc will turn any casts that are implicit in the C code into explicit<br>casts in the LLVM... which means that there is no good way to tell the
<br>difference between an implicit or explicit cast.<br><br>> What I've been doing is for each function taking all the<br>> instruction and going through each of their operands (and the opreands of<br>> their operands etc...) and checking to see if any are an instance of
<br>> UnaryConstantExpr. When I encounter such an instance, I determine whether<br>> the type of that value and its 0th operand differ, if they do its an<br>> implicit cast. I do basically the same procedure for the the global
<br>> variables. Is this the best approach to take or is there a better way of<br>> going about this?<br><br>I'm not sure I follow here.  It sounds like you are detecting things like:<br><br>short A = ...<br>int   B = ...
<br>int   C = (int)A + B;<br><br>However, there isn't a way to tell if the "(int)" was implicit or<br>explicit.<br><br>> I've asked at least a few questions on this mailing-list and you haveall<br>> been VERY helpful. Thank you all so much.
<br><br>:)<br><br>-Chris<br><br>--<br><a href="http://nondot.org/sabre/">http://nondot.org/sabre/</a><br><a href="http://llvm.org/">http://llvm.org/</a><br><br>_______________________________________________<br>LLVM Developers mailing list
<br><a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
</a><br></blockquote></div><br><br clear="all"><br>-- <br>John Trimble<br>Research Assistant<br>University of Arizona