neel
neel

Reputation: 9061

how to check the given instruction is using array in LLVM

What I want to ask is that can we check a given instruction is containing an array as operand in LLVM. I am writing a pass and stuck at this phase.

Upvotes: 1

Views: 771

Answers (1)

vkorchagin
vkorchagin

Reputation: 656

Yes, you can check this with following code:

Instruction *I;
bool UsingArray = false;
for (unsigned num = 0; num < I->getNumOperands(); ++num)
  if (isa<ArrayType>(I->getOperand(num)->getType()))
    UsingArray = true;

Upvotes: 2

Related Questions