[llvm-dev] Structure Padding and GetElementPtr

Hong Hu via llvm-dev llvm-dev at lists.llvm.org
Wed Dec 28 05:41:25 PST 2016


Hi all,

I'm writing a pass to understand the memory access to C++ class members.
For each GetElementPtr instruction, I check the second index to the class
pointer, to figure out which member it is intended to access.

However, due to the structure padding, there are some fake members inserted
into the structure. For example, when GEP works on the 5th element of the
padded structure, it may in fact works on the originally 3rd one, if there
are two paddings before the original 3rd member.

Is there any way to map this "5th" access to the original "3rd" one? For
example, some APIs to tell whether one member is a real member, or a padded
one?

Regards,
Hu Hong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161228/df34ab5b/attachment.html>


More information about the llvm-dev mailing list