Lines Matching refs:GEP
4 The Often Misunderstood GEP Instruction
14 `GetElementPtr <LangRef.html#i_getelementptr>`_ (GEP) instruction. Questions
15 about the wily GEP instruction are probably the most frequently occurring
17 sources of confusion and show that the GEP instruction is really quite simple.
22 When people are first confronted with the GEP instruction, they tend to relate
24 indexing and field selection. GEP closely resembles C array indexing and field
28 What is the first index of the GEP instruction?
47 provide the GEP instruction with two index operands. The first operand indexes
63 computation. The first operand to the GEP instruction must be a value of a
64 pointer type. The value of the pointer is provided directly to the GEP
82 In this "C" example, the front end compiler (llvm-gcc) will generate three GEP
84 function argument ``P`` will be the first operand of each of these GEP
104 In each case the first operand is the pointer through which the GEP instruction
118 These GEP instructions are simply making address computations from the base
130 directly to the GEP instructions.
136 the pointer that results from these GEP instructions would produce undefined
144 This question arises most often when the GEP instruction is applied to a global
153 The GEP above yields an ``i32*`` by indexing the ``i32`` typed field of the
163 #. Point #1 is evidenced by noticing the type of the first operand of the GEP
167 ``%MyStruct``. Since the first argument to the GEP instruction must always
174 What is dereferenced by GEP?
180 memory in any way. That's what the Load and Store instructions are for. GEP is
190 structure containing a pointer to an array of 40 ints. The GEP instruction seems
192 is actually an illegal GEP instruction. It won't compile. The reason is that the
194 array of 40 ints. Since the GEP instruction never accesses memory, it is
216 pointer and the GEP instruction can index through the global variable, into the
219 Why don't GEP x,0,0,1 and GEP x,1 alias?
224 If you look at the first indices in these GEP instructions you find that they
242 Why do GEP x,1,0,0 and GEP x,1 alias?
247 These two GEP instructions will compute the same address because indexing
261 Can GEP index into vector elements?
274 How is GEP different from ``ptrtoint``, arithmetic, and ``inttoptr``?
284 doesn't do this. With GEP you can avoid this problem.
286 Also, GEP carries additional pointer aliasing rules. It's invalid to take a GEP
292 And, GEP is more concise in common cases.
298 I'm writing a backend for a target which needs custom lowering for GEP. How do I do this?
301 You don't. The integer computation implied by a GEP is target-independent.
303 trees involving ADD, MUL, etc., which are what GEP is lowered into. This has the
306 GEP does use target-dependent parameters for the size and layout of data types,
310 fix a lot of code in the backend, with GEP lowering being only a small piece of
316 GEPs don't natively support VLAs. LLVM's type system is entirely static, and GEP
321 ``X[a*m+b*n+c]``, so that it appears to the GEP as a single-dimensional array
340 operand to the GEP. Indices greater than the number of elements in the
362 With the ``inbounds`` keyword, the result value of the GEP is undefined if the
368 address of allocated and sufficiently aligned memory. But the GEP itself is only
384 Can I do GEP with a different pointer type than the type of the underlying object?
388 pointer type. The types in a GEP serve only to define the parameters for the
400 You can compute an address that way, but if you use GEP to do the add, you can't
413 of GEP's special aliasing rules do not apply to pointers computed from ptrtoint,
419 As with arithmetic on null, You can use GEP to compute an address that way, but
436 What happens if a GEP computation overflows?
439 If the GEP lacks the ``inbounds`` keyword, the value is the result from
444 If the GEP has the ``inbounds`` keyword, the result value is undefined (a "trap
445 value") if the GEP overflows (i.e. wraps around the end of the address space).
473 Why is GEP designed this way?
476 The design of GEP has the following goals, in rough unofficial order of
483 particular, GEP is a cornerstone of LLVM's `pointer aliasing
515 emit a GEP with the base pointer casted to a simple address-unit pointer, using
517 sufficient to preserve the pointer aliasing guarantees that GEP provides.
526 #. The GEP instruction never accesses memory, it only provides pointer
529 #. The first operand to the GEP instruction is always a pointer and it must be
532 #. There are no superfluous indices for the GEP instruction.