<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Hi All,</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"> While reading "Arguments" section of getelementptr [1], the description is a little wired to me.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"> The first argument is always a type used as the basis for the calculations. The second argument</font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"> is always a pointer or a vector of pointers, and is the base address to start from.</font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"><br></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"> ...</font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"><br></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"> The first index always indexes the pointer value given as the first argument, ...</font><br></div><div class="gmail_default"><br></div><div class="gmail_default"><font face="arial, helvetica, sans-serif">Here I see the paragraph says the first argument is a *type*, then says the first index always indexes</font></div><div class="gmail_default"><span style="font-family:arial,helvetica,sans-serif">*the pointer value* given as the first argument. From </span><span style="font-family:arial,helvetica,sans-serif">getelementptr FAQ [2], I feel the first arguement</span><font face="arial, helvetica, sans-serif"><br></font></div><div class="gmail_default"><span style="font-family:arial,helvetica,sans-serif">(first operand in FAQ) should be </span><font face="arial, helvetica, sans-serif">*the pointer value*, and the following sentence seems not so right to</font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif">me.</font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"><br></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"> </font><span style="font-family:arial,helvetica,sans-serif">The first argument is always a type used as the basis for the calculations.</span></div><div class="gmail_default"><span style="font-family:arial,helvetica,sans-serif"><br></span></div><div class="gmail_default"><span style="font-family:arial,helvetica,sans-serif">Am I reading it wrong, or it is wrong. Thanks.</span></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/docs/LangRef.html#getelementptr-instruction">http://llvm.org/docs/LangRef.html#getelementptr-instruction</a></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">[2] <a href="http://llvm.org/docs/GetElementPtr.html">http://llvm.org/docs/GetElementPtr.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">Regards,</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">chenwj</div><div><br></div>-- <br><div class="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>