Gang.Yao
2010-May-08 03:26 UTC
[LLVMdev] does llvm have some way to get the size of data type
Hi: just like the c function sizeof(). I would avoid the usage of the c function call, and expect something like llvm intrinsic or some class providing this functionality. Does someone have experience in this? Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100507/056bae50/attachment.html>
Jeffrey Yasskin
2010-May-08 03:47 UTC
[LLVMdev] does llvm have some way to get the size of data type
Try http://llvm.org/doxygen/classllvm_1_1ConstantExpr.html#a2ea738dfa37ea93c71756be89ba8d92 or http://llvm.org/doxygen/classllvm_1_1TargetData.html#64c154a7844026e76e18f792ee4ad4b3 On Fri, May 7, 2010 at 8:26 PM, Gang.Yao <ttoole9 at gmail.com> wrote:> Hi: > > just like the c function sizeof(). I would avoid the usage of the c > function call, and expect something like llvm > intrinsic or some class providing this functionality. > > Does someone have experience in this? > Thanks > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >
Erick Tryzelaar
2010-May-08 09:20 UTC
[LLVMdev] does llvm have some way to get the size of data type
Hello! You can do this: http://nondot.org/sabre/LLVMNotes/SizeOf-OffsetOf-VariableSizedStructs.txt On Fri, May 7, 2010 at 8:26 PM, Gang.Yao <ttoole9 at gmail.com> wrote:> Hi: > > just like the c function sizeof(). I would avoid the usage of the c > function call, and expect something like llvm > intrinsic or some class providing this functionality. > > Does someone have experience in this? > Thanks > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100508/1b8c58e6/attachment.html>
Criswell, John T
2010-May-08 13:13 UTC
[LLVMdev] does llvm have some way to get the size of data type
Look at the getABITypeSize() method (or some method with a name like that) of the TargetData class. Note that TargetData is an LLVM analysis pass; you have to declare it as a prerequisite pass in your pass's getAnalysisUsage() method. -- John T. ________________________________________ From: llvmdev-bounces at cs.uiuc.edu [llvmdev-bounces at cs.uiuc.edu] On Behalf Of Gang.Yao [ttoole9 at gmail.com] Sent: Friday, May 07, 2010 10:26 PM To: llvmdev at cs.uiuc.edu Subject: [LLVMdev] does llvm have some way to get the size of data type Hi: just like the c function sizeof(). I would avoid the usage of the c function call, and expect something like llvm intrinsic or some class providing this functionality. Does someone have experience in this? Thanks
Jeffrey Yasskin
2010-May-08 16:53 UTC
[LLVMdev] does llvm have some way to get the size of data type
mike-m, is there any way to configure doxygen to produce human-readable anchors? They might have avoided the duplication on this thread, since Erick and John could have seen that I was linking to their suggestions. On Fri, May 7, 2010 at 8:47 PM, Jeffrey Yasskin <jyasskin at google.com> wrote:> Try http://llvm.org/doxygen/classllvm_1_1ConstantExpr.html#a2ea738dfa37ea93c71756be89ba8d92 > or http://llvm.org/doxygen/classllvm_1_1TargetData.html#64c154a7844026e76e18f792ee4ad4b3 > > On Fri, May 7, 2010 at 8:26 PM, Gang.Yao <ttoole9 at gmail.com> wrote: >> Hi: >> >> just like the c function sizeof(). I would avoid the usage of the c >> function call, and expect something like llvm >> intrinsic or some class providing this functionality. >> >> Does someone have experience in this? >> Thanks >> >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> >> >
Dan Gohman
2010-May-10 18:40 UTC
[LLVMdev] does llvm have some way to get the size of data type
On May 8, 2010, at 2:20 AM, Erick Tryzelaar wrote:> Hello! You can do this: > > http://nondot.org/sabre/LLVMNotes/SizeOf-OffsetOf-VariableSizedStructs.txtAlso, the ConstantExpr class has getSizeOf, getOffsetOf, and getAlignOf utility functions which make this easy. Dan
Seemingly Similar Threads
- [LLVMdev] does llvm have some way to get the size of data type
- [LLVMdev] does llvm have some way to get the size of data type
- [LLVMdev] does llvm have some way to get the size of data type
- [LLVMdev] How to retrieve IntToPtr from StoreInst?
- [LLVMdev] How to retrieve IntToPtr from StoreInst?