does llvm have some way to get the size of data type


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?


Hello! You can do this:

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.



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