 | InstructionBuilderGetElementPtrInBounds Method (Value, IEnumerableValue) |
[This is preliminary documentation and is subject to change.]
Creates a
Value that accesses an element of a type referenced by a pointer
Namespace:
Llvm.NET.Instructions
Assembly:
Llvm.NET (in Llvm.NET.dll) Version: 3.8.6158
Syntax
Remarks
For details on GetElementPointer (GEP) see http://llvm.org/docs/GetElementPtr.html. The
basic gist is that the GEP instruction does not access memory, it only computes a pointer
offset from a base. A common confusion is around the first index and what it means. For C
and C++ programmers an expression like pFoo->bar seems to only have a single offset or
index. However, that is only syntactic sugar where the compiler implicitly hides the first
index. That is, there is no difference between pFoo[0].bar and pFoo->bar except that the
former makes the first index explicit. In order to properly compute the offset for a given
element in an aggregate type LLVM requires an explicit first index even if it is zero.
See Also