Okay, make the prose match the example too.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29697 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer
2006-08-15 04:00:29 +00:00
parent 1c6f87d665
commit eda573ddf9

View File

@@ -78,12 +78,13 @@
AType* Foo; AType* Foo;
... ...
X = &amp;Foo-&gt;F;</pre> X = &amp;Foo-&gt;F;</pre>
<p>it is natural to think that there is only one index, the constant value <p>it is natural to think that there is only one index, the selection of the
<tt>1</tt>. This results from C allowing you to treat pointers and arrays as field <tt>F</tt>. However, in this example, <tt>Foo</tt> is a pointer. That
equivalent. LLVM doesn't. In this example, Foo is a pointer. That pointer must pointer must be indexed explicitly in LLVM. C, on the other hand, indexs
be indexed. To arrive at the same address location as the C code, you would through it ransparently. To arrive at the same address location as the C
provide the GEP instruction with two indices. The first indexes through the code, you would provide the GEP instruction with two index operands. The
pointer, the second index the element of the structure just as if it was:</p> first operand indexes through the pointer; the second operand indexes the
field <tt>F</tt> of the structure, just as if you wrote:</p>
<pre> <pre>
X = &amp;Foo[0].F;</pre> X = &amp;Foo[0].F;</pre>
<p>Sometimes this question gets rephrased as:</p> <p>Sometimes this question gets rephrased as:</p>