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

Try http://llvm.org/doxygen/classllvm_1_1ConstantExpr.html#a2ea738dfa37ea93c71756be89ba8d92
or http://llvm.org/doxygen/classllvm_1_1TargetData.html#64c154a7844026e76e18f792ee4ad4b3

Hello! You can do this:

http://nondot.org/sabre/LLVMNotes/SizeOf-OffsetOf-VariableSizedStructs.txt

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.

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.

No anchor naming options that I can find. But I'll keep an eye out for things that may improve anchor readability.

--mike-m

Thanks!

Also, the ConstantExpr class has getSizeOf, getOffsetOf, and
getAlignOf utility functions which make this easy.

Dan