<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">+llvm-dev list</div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-06-10 20:02 GMT+08:00 陳韋任 <span dir="ltr"><<a href="mailto:chenwj.cs97g@g2.nctu.edu.tw" target="_blank">chenwj.cs97g@g2.nctu.edu.tw</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Refer to [1], I believe you can use `getArraySize()` and `getType()` to get what you want.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Of course, you have to make sure the alloca does allocate an array by using `isArrayAllocation()`. </div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">[1] <a href="http://llvm.org/doxygen/classllvm_1_1AllocaInst.html" target="_blank">http://llvm.org/doxygen/<wbr>classllvm_1_1AllocaInst.html</a></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">HTH,</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">chenwj</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">2017-06-10 14:49 GMT+08:00 Dipanjan Das via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span>:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div><br></div><div>Let's say we the following: AllocaInst *alloca_inst = dyn_cast<AllocaInst>(&I) // I = instruction</div><div>Corresponding alloca instructions in IR are as follows:</div><div><br></div><div>%var1 = alloca [3 x i32], align 4<br></div><div>%var2 = alloca i32*, align 8<br></div><br clear="all"><div>How can I have the size and count (in case of array) of the allocated variables?</div><span class="m_6055043321447728557HOEnZb"><font color="#888888"><div><br></div>-- <br><div class="m_6055043321447728557m_3123808946078705624gmail_signature"><div dir="ltr"><span><div><div dir="ltr"><p>Thanks & Regards,</p>
<div>Dipanjan</div></div></div></span></div></div>
</font></span></div>
<br></div></div>______________________________<wbr>_________________<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/<wbr>mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div class="m_6055043321447728557gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Wei-Ren Chen (陳韋任)<br>Homepage: <a href="https://people.cs.nctu.edu.tw/~chenwj" target="_blank">https://people.cs.nctu.edu.tw/<wbr>~chenwj</a></div></div></div>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Wei-Ren Chen (陳韋任)<br>Homepage: <a href="https://people.cs.nctu.edu.tw/~chenwj" target="_blank">https://people.cs.nctu.edu.tw/~chenwj</a></div></div></div>
</div>