Dipanjan Das via llvm-dev
2017-Jun-10 14:39 UTC
[llvm-dev] Difference between AllocaInst::getType() vs AllocaInst::getAllocatedType()
>From the documentation, I can't understand the differencebetween AllocaInst::getType() vs AllocaInst::getAllocatedType() methods. Can anyone please enlighten me? -- Thanks & Regards, Dipanjan -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170610/cc16d00f/attachment.html>
John Criswell via llvm-dev
2017-Jun-10 16:05 UTC
[llvm-dev] Difference between AllocaInst::getType() vs AllocaInst::getAllocatedType()
On 6/10/17 9:39 AM, Dipanjan Das via llvm-dev wrote:> > From the documentation, I can't understand the difference > between AllocaInst::getType() vs AllocaInst::getAllocatedType() > methods. Can anyone please enlighten me?The AllocaInst instruction allocates stack memory. The value that it returns is always a pointer to memory. You should run an experiment to double-check this, but I believe AllocaInst::getType() returns the type of the value that is the result of the alloca while AllocaInst::getAllocatedType() returns the type of the value that is allocated. For example, if the alloca allocates a struct {int ; int}, then getAllocatedType() returns a struct type and getType() return a "pointer to struct" type. Regards, John Criswell> > -- > > Thanks & Regards, > > Dipanjan > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-- 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/20170610/e877f91f/attachment.html>