[LLVMdev] Patch: MSIL backend global pointers initialization

Artur Pietrek pietreka at gmail.com
Tue Apr 7 06:17:28 PDT 2009


Hello Anton

> %1 = tail call i32 (i8*, ...)* @printf(i8* noalias getelementptr ([16 x
> > i8]* @.str, i32 0, i32 0), i32 %0) nounwind
> > %10 = call i32 (i8*, ...)* @printf(i8* noalias getelementptr ([11 x i8]*
> > @.str2, i32 0, i32 0), i32 5) nounwind
> >
> > Instruction::isSameOperationAs() returns false for those two. Is it a
> > bug or I misunderstood something?
> These are two different instructions as you might see, thus - no bug :)


OK, I just need the same signature for both of those instructions.


>
> > In any case I wrote my custom isSame() operator for this but I'll
> > appreciate any hints.
> Why do you need this? Won't be enough just to compare function types?

I do something like this:

static bool areSame(Instruction *A, Instruction *B) {
  if (A->getOpcode() != B->getOpcode()) return false;
  if (A->getType()->getTypeID() != B->getType()->getTypeID()) return false;
  unsigned int a = A->getNumOperands();
  if (a != B->getNumOperands()) return false;
  for (unsigned int i = 0; i < a; ++i)
    if (A->getOperand(i)->getType()->getTypeID()
      != B->getOperand(i)->getType()->getTypeID()) return false;
  return true;
}

I'm not sure if it's too much.
Thanks!

Artur

P.S. Sorry for that [Junk...] in few mails. It's our "great" antispammer, I
will switch to gmail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090407/becbfa88/attachment.html>


More information about the llvm-dev mailing list