Soumya_Prasad_Ukil
2010-Jul-21 18:53 UTC
[LLVMdev] How to recognize pointer variable & ordinary variable
How to recognize pointer variable & ordinary variable? I have tried with "isa<PointerType>(V->getType())", but failed. -- regards, soumya prasad ukil -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100722/8a751551/attachment.html>
Duncan Sands
2010-Jul-21 19:31 UTC
[LLVMdev] How to recognize pointer variable & ordinary variable
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.
Soumya_Prasad_Ukil
2010-Jul-21 20:01 UTC
[LLVMdev] How to recognize pointer variable & ordinary variable
Your last statement is correct. But still my stand does not change. I want to differentiate ordinary local variable & pointer variables. Let's have a program, int a,b,c,*ptr; I want to extract only the local variables. That's what my question was. I think it is clear now. cast<PointerType>(A->getType()> > )->getElementType() is not working. I am also getting error with > A->getAllocatedType(). >On 22 July 2010 01:01, Duncan Sands <baldrick at free.fr> wrote:> 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. > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-- regards, soumya prasad ukil -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100722/19a28ba3/attachment.html>
Apparently Analagous Threads
- [LLVMdev] How to recognize pointer variable & ordinary variable
- [LLVMdev] How to recognize pointer variable & ordinary variable
- [LLVMdev] How to add a pass inside LLVM pass list
- [LLVMdev] How to add a pass inside LLVM pass list
- [LLVMdev] How to add a pass inside LLVM pass list