[LLVMdev] Patch: MSIL backend global pointers initialization

Artur Pietrek pietreka at gmail.com
Thu Apr 16 15:22:57 PDT 2009


Hello Anton

> > // CallSites have equal signatures
> > bool MSILWriter::cmpCallSite(CallSite A, CallSite B) {
> >   return (getCallSiteFType(A)==getCallSiteFType(B) &&
> >     A.getAttributes()==B.getAttributes());
> > }
> As it is impossible to honour argument attributes in MSIL I don't see
> why you should compare attributes. You seems to have the same MSIL
> call signature for calls with different param attrs.

I need to check attributes for signed or unsigned ints.
I guess it would be better to check just the sign extension.


>
> > // Comparision for std::lower_bound used in MSILWriter::printExternals()
> > bool MSILWriter::compareCallSite(CallSite A, CallSite B) {
> >   return getCallSiteFType(A)<getCallSiteFType(B);
> > }
> Hrm... You're building type for each comparison, which seems to be
> quite inefficient. Why don't iterate over all variadic call sites of
> the function and build a single map CS => FunctionType?


Good point, thanks.


> Also, here it
> seems you're trying to rely on (instable) numeric representation of
> pointers which can be quite unstable and in general bad for tests,
> etc.
>

Could you suggest the best way to compare FunctionTypes?


>
> > // Constructs function type from given CallSite
> At least - from arguments of the call :)


> > FunctionType* MSILWriter::getCallSiteFType(CallSite CS) {
> >   std::vector<const Type *> params;
> >   CallSite::arg_iterator AI=CS.arg_begin(), AE = CS.arg_end();
> Why don't shorten life of AI, AE and not define them in the for() loop
> header?
> >   for ( ; AI!=AE; ++AI )
> >     params.push_back((*AI)->getType());
>


Thanks,
Artur
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090417/b9f4b1d1/attachment.html>


More information about the llvm-dev mailing list