[LLVMdev] Patch: MSIL backend global pointers initialization

Anton Korobeynikov anton at korobeynikov.info
Thu Apr 16 12:49:02 PDT 2009


Hi, Artur

> // 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.

> // 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? 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.

>
> // 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());

-- 
With best regards, Anton Korobeynikov
Faculty of Mathematics and Mechanics, Saint Petersburg State University




More information about the llvm-dev mailing list