Abhinash Jain
2013-Sep-01 14:47 UTC
[LLVMdev] Distinguishing Pointer Variable and Ordinary Variable
Sorry I have actually edited the post. I did check its type by using isa<PointerType>(cast<AllocaInst>(instr->getOperand(1))->getAllocatedType()) but it is only detecting i32** %b on line 8 of IR as a pointer type. Whereas I also want to detect the i32* %1 on line 11 of IR as a pointer type. So how can I do this?? -- View this message in context: http://llvm.1065342.n5.nabble.com/Distinguishing-Pointer-type-variable-and-Ordinary-Variable-tp60881p60883.html Sent from the LLVM - Dev mailing list archive at Nabble.com.
Tim Northover
2013-Sep-01 19:01 UTC
[LLVMdev] Distinguishing Pointer Variable and Ordinary Variable
Hi, On 1 September 2013 15:47, Abhinash Jain <omnia at mailinator.com> wrote:> Sorry I have actually edited the post.This is primarily an e-mail list; the vast majority of us won't see any edits (on some web mirror?).> I did check its type by using > isa<PointerType>(cast<AllocaInst>(instr->getOperand(1))->getAllocatedType()) > but it is only detecting i32** %b on line 8 of IR as a pointer type.Not all pointers will come (directly or indirectly) from an AllocaInst. You might just want isa<PointerType>(instr->getOperand(1)->getType()), though of course that'll be true for any memory operand of a store instruction. Tim.
Duncan Sands
2013-Sep-02 10:08 UTC
[LLVMdev] Distinguishing Pointer Variable and Ordinary Variable
> Not all pointers will come (directly or indirectly) from an > AllocaInst. You might just want > isa<PointerType>(instr->getOperand(1)->getType()), though of course > that'll be true for any memory operand of a store instruction.isa<PointerType>(instr->getOperand(0)->getType()) will check if a pointer is being stored. Ciao, Duncan.
Maybe Matching Threads
- [LLVMdev] Distinguishing Pointer Variable and Ordinary Variable
- [LLVMdev] Distinguishing Pointer Variable and Ordinary Variable
- [LLVMdev] Distinguishing Pointer Variable and Ordinary Variable
- [LLVMdev] How to recognize pointer variable & ordinary variable
- [LLVMdev] Retrieving Underlying Type from AllocaInst