[LLVMdev] Patch: MSIL backend global pointers initialization

Artur Pietrek pietreka at gmail.com
Thu Apr 16 08:50:48 PDT 2009

Hi Anton

> > The interesting for me part of the CallInst is printf(i8* noalias %0, i32
> > 123).
> > I was diging in doxygen documentation but I really can't see the easy way
> to
> > compare those instructions and again finish with reinvented (but working)
> > wheel ;).
> Ah, sorry. I missed that you're doing variadic calls, not casting
> variadic function to definite ones. I think you can construct CallSite
> and then iterate over the arguments grabbing their types and construct
> function type after that.

So what do you think about that:

// CallSites have equal signatures
bool MSILWriter::cmpCallSite(CallSite A, CallSite B) {
  return (getCallSiteFType(A)==getCallSiteFType(B) &&

// Comparision for std::lower_bound used in MSILWriter::printExternals()
bool MSILWriter::compareCallSite(CallSite A, CallSite B) {
  return getCallSiteFType(A)<getCallSiteFType(B);

// Constructs function type from given CallSite
FunctionType* MSILWriter::getCallSiteFType(CallSite CS) {
  std::vector<const Type *> params;
  CallSite::arg_iterator AI=CS.arg_begin(), AE = CS.arg_end();
  for ( ; AI!=AE; ++AI )
  return FunctionType::get(CS.getCalledFunction()->getReturnType(),

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090416/43320474/attachment.html>

More information about the llvm-dev mailing list