Hello Anton<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">
> // CallSites have equal signatures<br>
> bool MSILWriter::cmpCallSite(CallSite A, CallSite B) {<br>
>   return (getCallSiteFType(A)==getCallSiteFType(B) &&<br>
>     A.getAttributes()==B.getAttributes());<br>
> }<br>
</div>As it is impossible to honour argument attributes in MSIL I don't see<br>
why you should compare attributes. You seems to have the same MSIL<br>
call signature for calls with different param attrs.</blockquote><div>I need to check attributes for signed or unsigned ints.<br>I guess it would be better to check just the sign extension.<br> <br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im"><br>
> // Comparision for std::lower_bound used in MSILWriter::printExternals()<br>
> bool MSILWriter::compareCallSite(CallSite A, CallSite B) {<br>
>   return getCallSiteFType(A)<getCallSiteFType(B);<br>
> }<br>
</div>Hrm... You're building type for each comparison, which seems to be<br>
quite inefficient. Why don't iterate over all variadic call sites of<br>
the function and build a single map CS => FunctionType? </blockquote><div><br>Good point, thanks.<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Also, here it<br>
seems you're trying to rely on (instable) numeric representation of<br>
pointers which can be quite unstable and in general bad for tests,<br>
etc.<br>
<div class="im"></div></blockquote><div><br>Could you suggest the best way to compare FunctionTypes?<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im"><br>
> // Constructs function type from given CallSite<br>
</div>At least - from arguments of the call :)</blockquote><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im"><br>
> FunctionType* MSILWriter::getCallSiteFType(CallSite CS) {<br>
>   std::vector<const Type *> params;<br>
>   CallSite::arg_iterator AI=CS.arg_begin(), AE = CS.arg_end();<br>
</div>Why don't shorten life of AI, AE and not define them in the for() loop header?<br>
<div class="im">>   for ( ; AI!=AE; ++AI )<br>
>     params.push_back((*AI)->getType());<br></div></blockquote></div><br><br>Thanks,<br>Artur<br>