<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Thu, Aug 31, 2017 at 7:55 AM Krzysztof Parzyszek via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 8/31/2017 8:11 AM, Anastasiya Ruzhanskaya via llvm-dev wrote:<br>
><br>
> I want to identify, that %s is pointer to struct, determine what this<br>
> struct is and determine the size of every component? With every<br>
> component is more or less ok, but the operand %s is not a struct but a<br>
> pointer. Is there a convenient way to track this structure usage in<br>
> getelementptr?<br>
<br>
If you have a Type* object that you know it a pointer, you can cast it<br>
to PointerType*, and then obtain the pointee type via getElementType<br>
member function.<br></blockquote><div><br>Note: Please don't rely on this, eventually pointer element types will go away. GEP does have a value type you can access directly. (GetElementPointer::getValueType, if I recall correctly)<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
If you have a Type* object that is a structure, you can cast it to<br>
StructType*, which then has iterators that allow you to inspect every<br>
member type.<br>
<br>
Look in include/llvm/IR/DerivedTypes.h for more information.<br>
<br>
-Krzysztof<br>
<br>
<br>
--<br>
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,<br>
hosted by The Linux Foundation<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div></div>