Shen Liu
2015-Jul-17 17:38 UTC
[LLVMdev] How can i differentiate pointer type int 32* from int 32** ?
Hi all, as a LLVM beginner I would like to know how can i check the pointer types with different levels like int 32* and int 32**, int 32***? By using value->getType()->isPointerTy() i can just know they are pointers. But the dump results clearly show they are different. Is there a good way to calculate their actual point to levels? Thanks! Best regards, Shen -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150717/0be5397a/attachment.html>
John Criswell
2015-Jul-17 17:47 UTC
[LLVMdev] How can i differentiate pointer type int 32* from int 32** ?
On 7/17/15 12:38 PM, Shen Liu wrote:> Hi all, as a LLVM beginner I would like to know how can i check the > pointer types with different levels like int 32* and int 32**, int 32***? > > By using value->getType()->isPointerTy() i can just know they are > pointers. But the dump results clearly show they are different. Is > there a good way to calculate their actual point to levels? Thanks!You will need to use dyn_cast<PointerType> to cast the Type * into a PointerType *. Once you do that, you can find the Type * that the PointerType points to. Regards, John Criswell> > > Best regards, > > Shen > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-- John Criswell Assistant Professor Department of Computer Science, University of Rochester http://www.cs.rochester.edu/u/criswell -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150717/6ebafcb4/attachment.html>
Shen Liu
2015-Jul-17 18:06 UTC
[LLVMdev] How can i differentiate pointer type int 32* from int 32** ?
John, thanks for you answer! But as far as I know LLVM doesn't provide any interface for finding the pointee of a pointer directly, so i have to process a multi-level pointer i need to write my own function to check pointers level by level, is that right? On Fri, Jul 17, 2015 at 1:47 PM, John Criswell <jtcriswel at gmail.com> wrote:> On 7/17/15 12:38 PM, Shen Liu wrote: > > Hi all, as a LLVM beginner I would like to know how can i check the > pointer types with different levels like int 32* and int 32**, int 32***? > > By using value->getType()->isPointerTy() i can just know they are > pointers. But the dump results clearly show they are different. Is there a > good way to calculate their actual point to levels? Thanks! > > > You will need to use dyn_cast<PointerType> to cast the Type * into a > PointerType *. Once you do that, you can find the Type * that the > PointerType points to. > > Regards, > > John Criswell > > > > Best regards, > > Shen > > > _______________________________________________ > LLVM Developers mailing listLLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.eduhttp://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > > > -- > John Criswell > Assistant Professor > Department of Computer Science, University of Rochesterhttp://www.cs.rochester.edu/u/criswell > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150717/ba304d4f/attachment.html>
Reasonably Related Threads
- [LLVMdev] How can i differentiate pointer type int 32* from int 32** ?
- [LLVMdev] How can i differentiate pointer type int 32* from int 32** ?
- [LLVMdev] AliasAnalysis calling failed in Pass interaction
- [LLVMdev] How to use get the memory location of a function argument correctly?
- [LLVMdev] How To Get The Name of the type the popinter is pointing to