[LLVMdev] How to recognize pointer variable & ordinary variable

Duncan Sands baldrick at free.fr
Wed Jul 21 12:31:21 PDT 2010


Hi Soumya_Prasad_Ukil,

> How to recognize pointer variable & ordinary variable? I have tried with
> "isa<PointerType>(V->getType())", but failed.

I'm not sure what you are asking, but if you are asking whether an
alloca instruction A represents local memory of pointer type, you
can use A->getAllocatedType().  You can also use
cast<PointerType>(A->getType())->getElementType().  The reason that
an alloca instruction always has pointer type is that the instruction
represents a pointer to the allocated memory.

Ciao,

Duncan.



More information about the llvm-dev mailing list