[llvm-dev] Difference between AllocaInst::getType() vs AllocaInst::getAllocatedType()

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[llvm-dev] Difference between AllocaInst::getType() vs AllocaInst::getAllocatedType()

Gerolf Hoflehner via llvm-dev

From the documentation, I can't understand the difference between AllocaInst::getType() vs AllocaInst::getAllocatedType() methods. Can anyone please enlighten me?

--

Thanks & Regards,

Dipanjan

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] Difference between AllocaInst::getType() vs AllocaInst::getAllocatedType()

Gerolf Hoflehner via llvm-dev
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
[hidden email]
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

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev